I wrote a OpenGL program, using glReadPixels(…) to get some information. However, the program works fine on some computers but fails on some other computers, especially on laptops. I checked my program and found glReadPixels(…) failed to feedback the information I needed. Is the problem related to the video card?
Failed means what exactly? Crash, bad values returned, …
You may need to flush the pipe with glFlush for some cards/drivers. Ive had this happen to me.
Im told that nvidia cards dont need this. glFlush could potentially cause a stall. Use it if speed doesnt matter, but try to limit it by combining several flushes into one (use your own trick)
You should also know that parts of the window that are offscreen are undefined and on some cards, if window is covered by another, it is undefined. For some, the backbuffer is shared.
Consider p-buffer (pixel buffers) where available.
Thank you, V-man. What I did was:
unsigned char Pixel_Data;
glReadPixels( point.x, point.y, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &Pixel_Data );
And for some computers, Pixel_Data do not get the right value. Could this related to video card? I updated the video driver, and I also added glFlush(), but it did not help. Is there anyway to fix the problem? Thank you again.
I found glStencilFunc() also failed on some systems!
with GL_STENCIL_BITS or whatever the token is.