PDA

View Full Version : glReadPixels



link19
03-04-2004, 12:50 PM
Im reading the pixels with glReadPixels and the bitmap is all gray...

Any idea why?

dorbie
03-04-2004, 11:38 PM
Need more info than this.

03-05-2004, 12:35 AM
I have had the same problem and it was due to read from the wrong buffer. If you are running with doublebuffering I found the following scheme to work

display(){
...renderToBuffer...
glReadBuffer( GL_BACK );

//w_ is width of window, same for h_
glReadPixels( 0 , 0 , w_ , h_ , GL_RGB ,GL_UNSIGNED_BYTE , (GLvoid*) pixels);

glutSwapBuffers();
}
//display end
my problem was that i made the grab after I swapped buffers which just gave me a blank picture.

Niels