View Full Version : retrieve frame buffer color and intensity value

02-12-2007, 12:02 AM
I had an application with RGB and gray display modes. I need to get the R,G,B color attribute of all pixels in color dipaly mode , and get the intensity attribute of all pixels in gray scale display mode.
COuld you inform me how to do this in wINDOW xp.

02-12-2007, 01:33 AM
Luminance (Y) = 0.2126 Red + 0.7152 Green + 0.0722 Blue

On older hardware you could call glCopyTexSubImage /glReadPixels to grab the frame buffer, then maybe use texture environment combiners to sum the scaled components.

Better still, if you have modern hardware you could use a fragment shader to perform the calculation directly, perhaps from a texture render target (FBO/Pbuffer) to avoid the glCopyTexSubImage/glReadPixels.

In any case, the calculation is OS neuTRAL :-)