color problem with glDrawPixels

Hi,

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 ?

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.

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.

Oooops…
My desktop was in 16Bits color mode…

hum…

Problem solved!