View Full Version : Can glReadPixels fail because of the video card?
05-13-2002, 10:48 AM
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?
05-13-2002, 08:35 PM
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.
05-14-2002, 05:13 AM
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.
05-14-2002, 12:58 PM
I found glStencilFunc() also failed on some systems!
05-14-2002, 01:20 PM
with GL_STENCIL_BITS or whatever the token is.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.