Reputation: 11
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):
MSAAframebuffer
and ResolveFramebuffer
(Resolve contains the texture).glViewport(0, 0, Width*1.5, Height*1.5)
MSAAframebuffer
and render my scene (the smiley).MSAAframebuffer
into the ResolveFramebuffer
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
Upvotes: 0
Views: 265
Reputation: 11
I found that I actually used an AABB somewhere else in the code to determine what to render; and this AABB was computed from the "small viewport's size". Stupid mistake.
Upvotes: 0