Graphics
Intel® graphics drivers and software, compatibility, troubleshooting, performance, and optimization
20498 Discussions

glReadPixels not working when reading from a FrameBuffer

JHutc4
Beginner
5,754 Views

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);

0 Kudos
12 Replies
Kevin_M_Intel
Employee
3,492 Views

Hi JohnHutch,

Can you please attach the dxdiag report of your system here? How to get it?

Dxdiag Report: Type dxdiag in Start Menu> open> Save> Attach using Advanced Editor Options.

If possible run the System Identification Utility and provide the code:

http://www.intel.com/support/siu.htm http://www.intel.com/support/siu.htm

Kevin M

0 Kudos
JHutc4
Beginner
3,492 Views

keven_intel

Thanks for getting back.

My Intel System ID code is 0280 9884

I have attached both reports.

0 Kudos
Kevin_M_Intel
Employee
3,492 Views

Thank you for sharing all this information. I will pass it to development so we can investigate this. I will contact you as soon as I have information.

Kevin M

0 Kudos
JHutc4
Beginner
3,492 Views

Kevin,

Any feedback on this issue yet?

0 Kudos
Kevin_M_Intel
Employee
3,492 Views

Hi JohnHutch,

I passed all this information to development and they are working now on this. At this point I do not have an ETA but as soon as I have information I will be back.

Kevin M

0 Kudos
Kevin_M_Intel
Employee
3,492 Views

We are still working and investigating this but in the meantime, I would recommend you posting on Developer Zone engage the knowledge and resources of that community.

Here is the link:

https://software.intel.com/en-us/ https://software.intel.com/en-us/

Kevin M

0 Kudos
JHutc4
Beginner
3,492 Views

Kevin,

Thanks. I will post a another item here.

However, I note that there are also 2 other items which relate to the same problem (see below). The first is in 2013 and the second earlier this year. Neither have had any replys. I have queried both for any resolution to the matter. All are reporting the problem as on Intel hardware only.

I believe there is a problem with the glReadPixels which has been there for some time. The common theme is that the buffer is not the default buffer (GL_BACK) but an alternate user created buffer.

I would like a resolution to this as if this cannot be resolved I won't be able to recommend Intel hardware to users of our software.

0 Kudos
Kevin_M_Intel
Employee
3,491 Views

If this is a different issue my best recommendation is to create a new post for each different issue. This is the best way for us to proceed gathering all important information.

Kevin M

0 Kudos
JHutc4
Beginner
3,492 Views

Kevin

This is the same issue, just reported 2 other times.

The glReadPixels call fails when you try and read from any buffer except the default Windows buffers.

I will raise another thread

0 Kudos
ROBERT_U_Intel
Employee
3,492 Views

Hi John

Feedback from our OGL folks:

I analyzed traces provided by customer, and I've not seen any glReadPixels call, unfortunately,

and I'm not able to see the issue.

But issue description lead to a question:

Is any error reported before call glReadPixels?

Please check glGetError before call glReadPixels.

Considering this:

"the code works OK for selection (ie the glReadPixel data is returning valid data and and just throwing this error)"

First error in customer log:

Source: OpenGL ; Type : Error ; Severity : HIGH ; Message : Error has been generated. GL error GL_INVALID_OPERATION

GL BUFFER ERROR in Debug Message : 1282

If error generated (in glReadPixels) no change is made to the contents of data.

glReadPixels Reference :

https://www.opengl.org/sdk/docs/man/ https://www.opengl.org/sdk/docs/man/

0 Kudos
ROBERT_U_Intel
Employee
3,492 Views

@ JohnHutch

I had our OGL developers look at the sample you provided and they did not see any issues. However, they did make a couple of recommendations as follows:

1. Make sure that fbo is complete (aStstus == GL_FRAMEBUFFER_COMPLETE)

aStatus := glCheckFramebufferStatus(GL_FRAMEBUFFER);

  1. 2. Add error check glGetError() after

glBindFramebuffer(GL_READ_FRAMEBUFFER, fFBOHandle);

Thanks

Robert

0 Kudos
JHutc4
Beginner
3,492 Views

Robert,

Thanks for the feedback.

I had been checking the FrameBuffer for GL_FRAMEBUFFER_COMPLETE and it is reporting GL_FRAMEBUFFER_COMPLETE.

I have added a check after glBindFrameBuffer(GL_READ_FRAMEBUFFER,fFBOHandle) for errors. There are no errors straight after this call, so I assume the Bind is OK.

The OpenGL debug message is generated in the ig75icd32.dll only when the glReadPixels is called. After that the GL ERROR is 1282 is in the GL Error stack (only one error in the stack)

I am running this on a Laptop with dual graphics (NVIDEA GTX 780M and Intel HD Graphics 4600). If I switch to the NVIDEA card all runs OK. I would like this software to run as is on the Intel hardware.

0 Kudos
Reply