🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to get RGB colors from image (with glsl)

Started by
2 comments, last by Mihumihu 6 years ago

Hi,

I'm trying to solve a problem where I can get all colors from image. 

I see only one: walk through a loop at raster data and collect all bytes, I'm sure there is a better way to get colors from image.  I'm thinking about some sort  of collecting colors in result texture...

Is it ordinary situation, could you help me, I didn find anithing on the internet...

Thanks.

Advertisement

Sounds like you're trying to build a color histogram (if I'm not misunderstanding your question :D ). 

Since WebGL doesn't have Compute shaders, retrieving texels on the CPU (using glReadPixels) and building the histogram on the CPU-side is probably the easiest way to solve your problem.

You'll have to iterate each bytes to count how many colors there are in your image in any case.

1 hour ago, petitrabbit said:

Sounds like you're trying to build a color histogram (if I'm not misunderstanding your question :D ). 

Since WebGL doesn't have Compute shaders, retrieving texels on the CPU (using glReadPixels) and building the histogram on the CPU-side is probably the easiest way to solve your problem.

You'll have to iterate each bytes to count how many colors there are in your image in any case.

I understand...I d like to speculate towards whole glsl approach

This topic is closed to new replies.

Advertisement