PDA

View Full Version : What's wrong with this picture?



Charlweed
05-28-2009, 11:03 AM
Hi,
I'm trying to use glreadpixels to save an image, but something is wrong with bpp or pixelformat or something else. My images are "brownish". Trial and error has not worked well. If I change the parameters of the pixelformatdescriptor, then ChoosePixelFormat fails. If I change bpp to something besides 4, then the image becomes distorted.

my pixelformatdescriptor is currently

pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.iLayerType=PFD_MAIN_PLANE;
pfd.cColorBits=32;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;

How might I get the first brownish image to look like the correct, second image?
http://hymes.name/snapshot_bad.png
http://hymes.name/snapshot_00.png

Thanks!

ZbuffeR
05-28-2009, 12:29 PM
Reverse red and blue components.
Something like RGBA versus BGRA.

Charlweed
09-14-2009, 12:24 PM
That was it! I had a typo where I used GL_BGRA instead of GL_RGBA;
Thanks!