PDA

View Full Version : problem of glReadPixels



weicao
01-04-2004, 03:00 AM
I want to find out whether a pixel is the background pixel.
code is as below:

glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
......
glReadBuffer(GL_FRONT_LEFT);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0,0,ImgWidth,ImgHeight,GL_RGB,GL_UNSI GNED_BYTE,pixmap);

then, when I read the R,G,B value from pixmap, they always are not 255, but '\0'.

what's the problem? is that problem of pixel format?

thanks a lot!

Adrian
01-04-2004, 06:21 AM
Are you sure you want "glReadBuffer(GL_FRONT_LEFT)"? Unless you are doing shutter glass stereo rendering you probably want "glReadBuffer(GL_BACK)"

For better speed use GL_BGRA_EXT and not GL_RGB, but get it working first http://www.opengl.org/discussion_boards/ubb/smile.gif