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 6 of 6

Thread: glReadPixel on Intel HD graphics

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    glReadPixel on Intel HD graphics

    Hi,
    I used glReadPixel() for reading the front buffer. But it returns only the contents of DC only, not the exact front buffer. In other cards(like NVIDIA,..) we get the exact front buffer.
    Is there any way to get the exact front buffer in IntelHD.??
    Currently glReadPixels() takes 23-38ms in IntelHD, Is there any way to reduce this??

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    800

    Re: glReadPixel on Intel HD graphics

    A few options,
    1) Use FBO to render to texture directly.
    2) Use PBO along with glReadPixels to asynchronously transfer data.
    Regards,
    Mobeen

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    Re: glReadPixel on Intel HD graphics

    I already tried these methods. I need to get images drawn by GPU and CPU. And also I need to get the same in a CPU buffer. PBO is not properly working in Intel HD machines. GetTexImage took aroung 220ms to 245ms for one read in Intel HD machine.

    I have found another thing that GetDIBits() using DesktopDC also took 33ms to 38ms for one read in Intel HD machine.

    In NVDIA glReadPixel took only 2ms to 4ms and GetDIBits() took only 3ms to 6ms.

    Please help, I need to read 60 times in one second. So only allowed ms is 16ms.

    Thanks in advance.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: glReadPixel on Intel HD graphics

    If Intel's drivers don't let you do so fast, then there's nothing you can do. OpenGL specifies behavior, not performance. Performance is up to the implementation. And Intel has repeatedly shown just how little they care about the quality of their OpenGL drivers.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,215

    Re: glReadPixel on Intel HD graphics

    glReadPixels performance can be improved on Intel, but you need to ensure that you've got the format and type parameters exactly matching those that GL uses internally; typically that will be GL_BGRA for format and GL_UNSIGNED_INT_8_8_8_8_REV for type. That's for the backbuffer; you may need to experiment with other formats and types in order to get a match for the front buffer.

    Note that this will still need to stall the pipeline in order to do the readback, so it's never going to have the best performance. A PBO can help but it's not going to be of use if you need the data CPU-side in the same frame as you do the read.

    The other alternative is to have a look at exactly what it is that you're doing with the data CPU-side and see if you can move those operations to the GPU.

    It's worth noting that a good rule of thumb with Intel is: "if you can't do it in D3D then you shouldn't even try to do it in OpenGL either, even if you're supposed to be able to". Reading from the front buffer is something that D3D doesn't support very well ("this function is very slow, by design, and should not be used in any performance-critical path", according to the SDK documentation), so based on that rule it's not surprising that it doesn't work too great in OpenGL.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    3

    Re: glReadPixel on Intel HD graphics

    PBO is not working in Intel HD machine. I found one another thing that the glReadPixels returns 0.03 ms when using glut window but with MFC window it is returning only after 2.5 ms in NVDIA card.

    Why this difference

    Thanks for the replay.

    Format and type parameters exactly matching gives much improvement that the time reduced to 14ms for a read.

Posting Permissions

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