Hi,
I have a viewport created with a PixelFormat without multisampling (in theory).
Code :pfd = new PixelFormatDescriptor(); OperatingSystem osInfo = System.Environment.OSVersion; pfd.dwFlags = (int) (pixelFormat.DRAW_TO_WINDOW | pixelFormat.SUPPORT_OPENGL | pixelFormat.DOUBLEBUFFER); if (osInfo.Version.Major >= 6) pfd.dwFlags = pfd.dwFlags | (int)pixelFormat.SUPPORT_COMPOSITION; pfd.PixelType = (int) pixelTypes.TYPE_RGBA; pfd.ColorBits = 24; pfd.AlphaBits = 8; pfd.DepthBits = 24; nPixelFormat = Windows.ChoosePixelFormat(theHdc, pfd); bool valid = Windows.SetPixelFormat(theHdc, nPixelFormat, pfd); theHrc = wglCreateContext(theHdc); wglMakeCurrent(hdc, theHrc);
I create a Multisample FBO with a number of samples defined by my application
Code :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); fbo = 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); CheckFboStatus(Status);
Then I draw my scene on this FBO and I copy it (only the color bits) to the Framebuffer with glBlitFramebufferEXT:
Code :gl.BindFramebufferEXT(gl.READ_FRAMEBUFFER_EXT, fbo); gl.BindFramebufferEXT(gl.DRAW_FRAMEBUFFER_EXT, 0); gl.BlitFramebufferEXT(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST); gl.BindFramebufferEXT(gl.READ_FRAMEBUFFER_EXT, 0); gl.BindFramebufferEXT(gl.DRAW_FRAMEBUFFER_EXT, 0);
Now, if the user overrides the Antialiasing settings on the "Graphics Card Settings" page and sets a number of samples different from the one used by my internal FBO, I get a GL_INVALID_OPERATION after the call to glBlitFramebufferEXT.
If instead the user sets the number of Samples equal to the one I use internally for the FBO, or if he leaves the Antialiasing settings to "Application Controlled" it works fine.
My guess is that when the option to override the application settings is set, the Framebuffer is craeted with the number of samples specified by the graphics card settings page and copying between buffers with different samples number gives the error.
Can anybody help?





If pixelformat advertises components that are shifted in a way that default framebuffer is BGRA then it cant be done, since GL doesnt expose such internal formats.