PDA

View Full Version : glDrawPixels with 10 or 12 bit raw image data



Johann
03-14-2009, 02:37 AM
Dear forum members,

I'm new to OpenGL...

I try to develop an application which renders images to a window. Nothing complicated so far, this works with RGB data without problems.

But: The data I would like to render comes from a CMOS sensor and is 10 bit grayscale (my second sensor deliveres 12 bit raw data).

Is there a way to let glDrawPixels draw these pixel data and let opengl do the conversion from 10/12 bit to the 8 bit of the screen? Or do I have to convert it by myself, either by downscale it from 10/12 to 8 or to cut off the bits?

If I cut off the lower bits, the resulting 8 bit grayscale image is okay - opening in photoshop for example. And: how may I render a 8 bit grayscale image?

Any comments welcome!

Best Regards,
Johann

Ilian Dinev
03-14-2009, 05:16 AM
Do convert to GL_LUMINANCE8
Though, as you use glDrawPixels, I guess speed is not an issue (i.e streaming the video)?

There are ways to make the gpu read and display 10bpp/12bpp/whatever-bpp without doing any conversion on the CPU, but they require shaders and a DX10-class videocard.