PDA

View Full Version : glReadPixels problem



RJH
07-14-2001, 07:51 PM
I need an answer to this!
I'm trying to read current viewport:

glFinish();
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);

glReadPixels(0, 0, size.x, size.y, GL_RGB, GL_UNSIGNED_BYTE, pBits);

All of the args to glReadPixels are valid. However, I'm not getting anything - nothing (!!) - into the allocated pBits buffer. Have tried every possible format: GL_RGBA, GL_BGR_EXT, GL_BGRA_EXT, GL_COLOR_INDEX but no luck.
My system video is set up for 16-bit color, i.e. 16 bits per pixel. Can glReadPixel handle that format? If OpenGL can render to the screen OK, it should be able to read the pixel color info back without problems.

07-14-2001, 10:40 PM
How do you know that nothing is written to the buffer? What do you do after the above code?