glReadPixels fails on Intel HD 4600 but works OK on NVIDEA and AMD

I am trying to read values from a FrameBuffer (GL_COLOR_ATTACHMENT0). The Framebuffer status is OK and there are no GLErrors until I make the glReadPixels call. I then get a #1282 GL Error and the OpenGL debug returns a
“Source: OpenGL ; Type : Error ; Severity : HIGH ; Message : Error has been generated. GL error GL_INVALID_OPERATION” error.

The same code works fine on NVIDEA and AMD hardware. Is this an Intel driver issue?

Please see some code snippets below

Read Pixels

 Var PixelID : array [0..3] of GLFloat; 
      ByteD   : Array [0..3] of Byte;
begin
    ObjID := 0;
    if fFBOHandle  = 0 then exit;


    PixelID[0]:=0;
    PixelID[1]:=0;
    PixelID[2]:=0;


    glBindFramebuffer(GL_READ_FRAMEBUFFER, fFBOHandle);


    if fColBufSize>=1 then
    Begin
      glReadBuffer(GL_COLOR_ATTACHMENT0);
//test 1
      glReadPixels(x, y, 1, 1, GL_RGBA,   GL_FLOAT, @PixelID[0]);
/test 2
      glReadPixels(x, y, 1, 1, GL_RGBA,   GL_BYTE, @ByteD[0]);


      glReadBuffer(GL_NONE);
    end;




  //release frame buffer
    glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);

Framebuffer set up. Here I am using GL_RGBA32F as the “internalformat”

   // Create the FBO
      glGenFramebuffers(1, @fFBOHandle);
      glBindFramebuffer(GL_FRAMEBUFFER, fFBOHandle);


  // Create the texture object for the primitive information buffer
      glGenRenderBuffers(fColBufSize, @fColorTexture[0]);


      for I := 0 to fColBufSize-1 do
      Begin
        glBindRenderBuffer(GL_RENDERBUFFER, fColorTexture[i]);
        glRenderBufferStorage( GL_RENDERBUFFER, fFBOMode,  SizeX, SizeY );
        glFramebufferRenderBuffer (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + I, GL_RENDERBUFFER, fColorTexture[i] );
        fBuffer[i] :=  GL_COLOR_ATTACHMENT0 + I;
      end;


  // depth
      if fIncDepthBuffer then
      Begin
        glGenRenderBuffers(1, @fDepthBuff);
        glBindRenderBuffer(GL_RENDERBUFFER, fDepthBuff);
        glRenderBufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,  SizeX, SizeY );
        glFramebufferRenderBuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fDepthBuff);
      end;


      glDrawBuffers(fColBufSize, @fBuffer[0]);


  // Verify that the FBO is correct
      aStatus := glCheckFramebufferStatus(GL_FRAMEBUFFER);
      CheckForGLErrors('Float Buffer Set Size');


  // Restore the default framebuffer
      glReadBuffer(GL_NONE);    //for older hardware


      glBindRenderbuffer(GL_RENDERBUFFER, 0);
      glBindFramebuffer(GL_FRAMEBUFFER, 0);



It seems I can use glReadPixels on the GL_BACK buffer OK. It only fails on a RenderBuffer (as above).

The following code does not generate an error



         glReadBuffer(GL_BACK);
         glReadPixels(x, y, 1, 1, GL_RGBA,   GL_FLOAT, @PixelID[0]) ;
         glReadBuffer(GL_NONE);


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.