PDA

View Full Version : 8 bit bitmap



xargon
01-11-2006, 06:12 AM
Hi everyone,

Does anyone know how I can display an 8 or a 16 bit BMP with the glDrawPixels function. It only seems to be able to handle the 24 and 32 bit variety.

Any help would be greatly appreciated.

Cheers,
xarg

RigidBody
01-11-2006, 09:36 AM
i don't think there is an easy way. an 8-bit bitmap file usually consists of a colormap (defining RGB values for 256 user colors and thereby having a size of 3*256=768 bytes), and for each pixel a one-byte value which acts as an index into the colormap. afaik, there is no way to make OpenGL use that colormap.

you'll have to write a subroutine which converts the pixel values from the bitmap file to a format which OGL can use. but that doesn't seem to be too hard ;) anyway you'll have to do it only once in your life...so it's a good exercise