problem of glReadPixels

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_UNSIGNED_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!

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