Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: glReadPixels is failing...sometimes...on just one computer

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    8

    glReadPixels is failing...sometimes...on just one computer

    I'm using glReadPixels in my app for object picking and screen capture, and it works on all computers so far, except one. On the problem computer, glReadPixels only works intermittently. I have found that there are two conditions where glReadPixels will work correctly on this machine:

    1) If I run the app in a window. In full screen, the viewport is 1690 x 984. If I reduce this to about 1592 x 930, glReadPixels will work correctly. Larger than that, and it will fail, even in a window.

    2) If I place enough objects on the screen. I haven't nailed down what the threshold is, but if I put enough objects on the screen, glReadPixels starts working.

    I'm pretty baffled. Has anyone experienced a problem like this? Do the workarounds I've listed suggest to anyone where things might be going wrong?

  2. #2
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251
    ever tried running your application in debug mode? judging by amount of "random" behavior it might be useful. also, try gDebugger - OpenGL debugger. most probably you have a lot of OpenGL errors long before glReadPixels call.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    8
    Debug mode, yes, constantly. I haven't even built a release version yet. But gDebugger...that's sounds like a good idea. I'll give that a try, thanks.

  4. #4
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251
    debug mode won't be much help if you're using dynamically allocated(new\delete) arrays instead of vector and string. it won't give any consistent errors in case of out of bounds access and stuff like that. you will be just chasing phantom bugs.

  5. #5
    Intern Newbie
    Join Date
    Oct 2010
    Posts
    47
    Hello,

    I also had a problem with glReadpixels : the depth buffer was invalid on parts of the view (http://www.opengl.org/discussion_boa...=1#post1248827).
    The problem was only on ATI cards with old drivers.
    The only workaround that I have found in my case was to disable anti-aliasing ; with GL_*_SMOOTH or with MSAA there is a problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •