glReadPixel on Intel HD graphics

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??

A few options,

  1. Use FBO to render to texture directly.
  2. Use PBO along with glReadPixels to asynchronously transfer data.

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.

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.

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.

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.