0

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.

problem shown as an image!

To summarize, this is the general flow (too much code to post it all):

  1. Create MSAAframebuffer and ResolveFramebuffer (Resolve contains the texture).
  2. Set glViewport(0, 0, Width*1.5, Height*1.5)
  3. Bind MSAAframebuffer and render my scene (the smiley).
  4. Blit the MSAAframebuffer into the ResolveFramebuffer
  5. 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

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • Do you have a scissor state set to your screen's resolution perhaps? – Columbo Mar 17 '22 at 22:15
  • Thank you so much for your response. However, 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. – JustAGuyWithALoaf Mar 30 '22 at 08:21

1 Answers1

0

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.