I have another problem related to this thread (glBlitFramebufferEXT and AA set by the Graphics card settings - OpenGL: Basic Coding - Khronos Forums)
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.RENDERBUFFER_EXT, samples, gl.RGB, Width, Height);
rbDepth = gl.GenRenderbuffersEXT();
gl.BindRenderbufferEXT(gl.RENDERBUFFER_EXT, rbDepth);
gl.RenderbufferStorageMultisampleEXT(gl.RENDERBUFFER_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?