View Full Version : color problem with glDrawPixels

09-10-2002, 11:10 PM

I use glReadPixels to copy a part of my
backbuffer, and then I draw thoses pixels later on my backbuffer but color have change!!!

I have the same problem with glCopyTexSubImage2D.

anyone have an idea ?

09-10-2002, 11:17 PM
check the RGB ordering. you are probably getting your red and blue swapped if you are using 32 bit color buffer and reading as GL_UNSIGNED_INT. openGL uses the systems native byte ordering, so on windows blue ends up in the least significant byte.

you may need to draw pixels as GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV. or use GL_RGBA, GL_UNSIGNED_BYTE.

09-10-2002, 11:26 PM
I don't think its a color format problem (i use GL_BGRA_EXT GL_UNSIGNED_BYTE), because the color change a little, i mean the red is still red and green and blue still green and blue, but color become a little bit more clear, like if there was a conversion problem between internal float format color and byte format color.

09-10-2002, 11:40 PM
My desktop was in 16Bits color mode...


Problem solved!