PDA

View Full Version : glBlitFramebuffer with multisampling problem



thekend
12-23-2010, 04:13 AM
Hi!

My problem is the following:

I use two windows, there are only 1 GL context. The windows have single-sampled default framebuffers.
window1 has dimensions 1280x1024
window2 has dimensions 1050x1680

I use one FBO with color + depth/stencil renderbuffers. The formats are the same as the default framebuffers.
The dimensions are 1280x1680.

What I'm doing is:
- make current context to draw to window1
- bind draw buffer to FBO
- render image1 to FBO with viewport (0,0,1280,1024).
- bind read buffer to FBO and draw buffer to 0.
- glBlitFramebuffer(0, 0, 1280, 1024, 0, 0, 1280, 1024, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST)
- make current context to draw to window2
- bind draw buffer to FBO
- render image2 to FBO with viewport (0,0,1050,1680)
- bind read buffer to FBO and draw buffer to 0.
- glBlitFramebuffer(0, 0, 1050, 1680, 0, 0, 1050, 1680, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST)
- SwapBuffers(window1)
- SwapBuffers(window2)

If the render buffers in FBO are single-sampled, everything work as expected, i get image1 in window1 and image2 in window2.

However, if they are multisampled, I get in window1 the followings:

- in the top left 1050x656 is the top 1050x656 part of image2
- the top right 230x1280 is black
- in the bottom 1280x368 is the top 1280x368 part of image1

Otherwise window2 has image2 correctly. It looks like that the copied part in window1 is not the (0,0,1280,1024) of the FBO but the (0,1280-1024,1280,1024), e.g. not the bottom 1280x1024 part, but the top one.

Am I missing something about blitting multisampled framebuffers or is it a driver bug?