PDA

View Full Version : glBlitFrameBufferExt problem on ATI card



Devdept2
06-18-2012, 08:47 AM
I have another problem related to this thread (http://www.opengl.org/discussion_boards/showthread.php/177736-glBlitFramebufferEXT-and-AA-set-by-the-Graphics-card-settings?goto=newpost)
that's driving me mad:

I create 2 hidden FBOs: one with multisampling (let's call it A) and one with no multisampling (let's call it B), both are created with Color and Depth renderBuffer attached.


I want to copy the depthBuffer of A to B, with the glBlitFramebufferEXT(), but I have a strange behaviour.

Creation of the FBO without multisample:


fbo = gl.GenFramebuffersEXT();


FrameBufferObject.Enable(fbo);




rbColor = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, rbColor);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.RGB, Width, Height);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.COLOR_ATTACHMENT0_EXT, gl.RENDERBUFFER_EXT, rbColor);

rbDepth = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, rbDepth);
gl.RenderbufferStorageEXT(gl.RENDERBUFFER_EXT, gl.DEPTH_COMPONENT, Width, Height);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.DEPTH_ATTACHMENT_EXT, gl.RENDERBUFFER_EXT, rbDepth);

_status = gl.CheckFramebufferStatusEXT(gl.FRAMEBUFFER_EXT);


Creation of the FBO with multisample


rbColor = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, rbColor);
gl.RenderbufferStorageMultisampleEXT(gl.RENDERBUFF ER_EXT, samples, gl.RGB, Width, Height);


rbDepth = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, rbDepth);
gl.RenderbufferStorageMultisampleEXT(gl.RENDERBUFF ER_EXT, samples, gl.DEPTH_COMPONENT, Width, Height);


fboMultisample = gl.GenFramebuffersEXT();
FrameBufferObject.Enable(fbo);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.COLOR_ATTACHMENT0_EXT, gl.RENDERBUFFER_EXT, rbColor);
gl.FramebufferRenderbufferEXT(gl.FRAMEBUFFER_EXT, gl.DEPTH_ATTACHMENT_EXT, gl.RENDERBUFFER_EXT, rbDepth);


_status = gl.CheckFramebufferStatusEXT(gl.FRAMEBUFFER_EXT);


Copy of the 2 FBO:



glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboMultiSample);
glBindFramebufferEXT(GL_WRITE_FRAMEBUFFER_EXT, fbo);
glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height, GL_DEPTH_BUFFER_BIT, gl.NEAREST);



On 2 ATI cards I tested (ATI FirePro v3750 and FirePro v4800 ) the copy works if I create the 2 FBOs before the viewport is shown for the first time, whilst if I create them after the first OnPaint of my viewport, I get GL_INVALID_OPERATION error. (if I try to copy the color buffer that works fine, though).

This problem occurs only if I force the AntiAliasing from the graphics card driver settings.


On an NVIdia card (Gefoce 8600M GS) it works fine in both cases.


Am I doing something wrong or are there some problems/limitations on ATI cards with glBlitFrameBuffer?