Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
470 Discussions

Async readpixels from FBP using PBO seem not to work



We are using PBO to async read back pixels GPU -> CPU (for hardware feedback in virtual texture).

Unfortunately, both glReadPixels and glGetTexImage causes stall (instead of immediate return).

PBO read Code is looking like that:


          glGenBuffers(1, &delayedPBO);
          glBindBuffer(GL_PIXEL_PACK_BUFFER, delayedPBO);
          glBufferData(GL_PIXEL_PACK_BUFFER,  width*height*4, NULL, GL_STREAM_READ);  

          glGenTextures(1, &textureId);

          glBindTexture(GL_TEXTURE_2D, textureId);

          glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0);

          glBindTexture(GL_TEXTURE_2D, 0);

    glGenFramebuffers(1, &fboId);


    glBindFramebuffer(GL_FRAMEBUFFER, fboId);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0);

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

//...render something...


        glBindBuffer(GL_PIXEL_PACK_BUFFER, delayedPBO);

        glBindTexture(GL_TEXTURE_2D, textureId);

        glGetTexImage( GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0 );//<< causes stall!


        //glBindFramebuffer(GL_FRAMEBUFFER, fboId);

        //glReadBuffer( GL_COLOR_ATTACHMENT0  );

        //glReadPixels( 0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0 );

        glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);


Any ideas? Works fine on NVIDIA.

OS: Windows 7,

Video: Intel 4600



0 Kudos
2 Replies

I am also having a similar problem. I am using a FrameBuffer object for selection and want to read back from the FrameBuffer.  I can read back from the default buffer (GL_BACK) but not from the frame buffer.  I have also tried the PACK_BUFFER approach which also fails.

 I have an Intel HD 4600 with the latest drivers.  I am getting an OpenGL Debug message back from the ig75icd32.dll of a GL_INVALID_OPERATION and a GLError 1282 is on the error stack.

I have this posted in  My code snippets have been reviewed as OK.

This code also works fine with NVIDEA and AMD cards.

I would like my code to work on Intel hardware so I can recommend this hardware for users of our software.

There has been no feedback on this  Have you resolved it??

0 Kudos

The very recent beta driver seem not stalling in that case.

According to what I see in your snippet, everything is correct.

I would suggest to experiment with glReadPixels format/type. Previous Intel drivers were very sensitive to it Try use GL_BGRA instead of GL_RGBA, or GL_RGBA32F, instead of GL_FLOAT.

Also, pixel buffer object (PBO) should work more correctly/stable, since this way you are not passing format in two different ways (both internal and general), like glReadPixels

0 Kudos