I have made an image below to indicate my problem. I render my scene to an offscreen framebuffer with a texture the size of the screen. I then render said texture to a screen-filling quad. This produces the case 1 on the image. I then run the exact same program, but with with a texture size, let's say, 1.5 times greater (enough to contain the entire smiley), and afterwards render it once more to the screen-filling quad. I then get result 3, but I expected to get result 2.
I remember to change the viewport according to the new texture size before rendering to the texture, and reset the viewport before drawing the quad. I do NOT understand, what I am doing wrong.
To summarize, this is the general flow (too much code to post it all):
- Create
MSAAframebuffer
andResolveFramebuffer
(Resolve contains the texture). - Set
glViewport(0, 0, Width*1.5, Height*1.5)
- Bind
MSAAframebuffer
and render my scene (the smiley). - Blit the
MSAAframebuffer
into theResolveFramebuffer
- Set
glViewport(0, 0, Width, Height)
, bind the texture and render my quad.
Note that all the MSAA is working perfectly fine. Also both buffers have the same dimensions, so when I blit it is simply: glBlitFramebuffer(0, 0, Width*1.5, Height*1.5, 0, 0, Width*1.5, Height*1.5, ClearBufferMask.ColorBufferBit, BlitFramebufferFilter.Nearest)
Hope someone has a good idea. I might get fired if not :D