image intensity

i would like to calculate image intensity:
R+G+B/3 for all pixels in one image.
the image is already loaded in the gpu for texture mapping.
is there any extension that can help me?
thanks, oren.

First of all, I think it’s not the best place for such a question.

Now, I think you must keep in memory the data you give to glTexImage2D. Then, you’ll be able to work with that data and do any calculations you want as long as you know how the values are stored in that (big) array.

What are your real intentions with wanting to do so ?

Thanks, Jide.
Can you recommend me for a better place?
I want to use the GPU to calculate the image intensity. I think it will be faster then the CPU.
I assume I can call glTexImage2D and then call some function in the GPU that will calculate the image intensity

Well, maybe the advanced forum could help you.
I also think that you might be able to use shaders to do that work.

However, as an image is static, and assuming you don’t change your textures very often, I’d like to say you really should do it for once, when you know all the data array you give to make your texture.

I actually cannot say more.

Hope that helps.

I found a pixel shader for histogram of nvidia that can help me. But I need it to work on ati/intel too. I think I will do it once on the host cpu, as you suggested. Thanks, oren.

That is not the way to compute intensity. Use
value = 0.30R + 0.59G + 0.11B,
or luminance = = 0.2125 R + 0.7154 G + 0.0721 B.