I have an Intel HD 4600 Notebook with the latest Drivers (10.18.10.3960 29/9/2014) running on Windows 8.1 64bit.
I am writing an OpenGL application which needs to read pixels from a Framebuffer. The Intel Driver reports an OpenGL error 1282 and fails to read. I have tried different formats (GL_FLOAT and GL_UNSIGNED_BYTE etc), but all fail. I believe the code is OK as the same code works fine on NVIDEA and AMD hardware.
NOTE The glReadPixels works OK if I am reading from the GL_BACK buffer and only fails if I attempt to read from another buffer.
Is this a Driver Bug or am I doing something wrong?? Any assistance to get this working appreciated.
Some code below...
Setup the Frame Buffer
// Create the FBO
glGenFramebuffers(1, @fFBOHandle);
glBindFramebuffer(GL_FRAMEBUFFER, fFBOHandle);
// Create the texture object for the primitive information buffer
glGenRenderBuffers(fColBufSize, @fColorBuffer[0]);
for I := 0 to fColBufSize-1 do
Begin
glBindRenderBuffer(GL_RENDERBUFFER, fColorBuffer[I]);
glRenderBufferStorage( GL_RENDERBUFFER, GL_RGBA32F, SizeX, SizeY );
glFramebufferRenderBuffer (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + I, GL_RENDERBUFFER, fColorBuffer[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);
Read the Pixels from the FramBuffer. The PixelID is a local array and X,Y is the mouse location.
glBindFramebuffer(GL_READ_FRAMEBUFFER, fFBOHandle);
glReadBuffer(GL_COLOR_ATTACHMENT0);
glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, @PixelID[0]);
glReadBuffer(GL_NONE);