I'm getting some artifacts when I try to use a colour attachment on an FBO. I'm saving my first pass as a texture, then passing it as an input to an anti-aliasing shader. The result is, as below, some weird noise and an enforced black background. The AA is applied fine.


GL.BindFramebuffer(FramebufferTarget.FramebufferExt, _hndFBO);
GL.BindTexture(TextureTarget.Texture2D, 0);
GL.DrawBuffer((DrawBufferMode) FramebufferAttachment.ColorAttachment0Ext);
GL.Viewport(0, 0, _intWidth, _intHeight);
//Do rendering here
GL.BindFramebuffer(FramebufferTarget.FramebufferExt, 0);

Any ideas? Need more code?


Are you clearing the back buffer before you render to it each frame?

I'm assuming magenta is "transparent" in the first picture. If so, the parts of the back-buffer where there is no terrain are not affected. Residual data could very well account for what you are seeing.

| improve this answer | |
  • \$\begingroup\$ PS: the anti-aliased terrain looks lovely! \$\endgroup\$ – drxzcl Aug 15 '10 at 11:18
  • \$\begingroup\$ Yeah, that looks like a classic "didn't clear the buffer" issue. \$\endgroup\$ – JasonD Aug 15 '10 at 11:58
  • \$\begingroup\$ Fixed it! I was clearing the buffer too early it seems. I had figured that was the issue initially but after trying a few combinations it wasn't helping and I, mistakenly, moved on. @Ranieri Thanks :) I've got a version with a higher LOD: facebook.com/… Still plenty of work to go... \$\endgroup\$ – Rushyo Aug 15 '10 at 12:35
  • \$\begingroup\$ (Only started playing with OpenGL this week) \$\endgroup\$ – Rushyo Aug 15 '10 at 12:36
  • \$\begingroup\$ Hmmm.. spoke too soon. That killed the AA... Ah well. I'll have a poke around. Least I'm sure of where to look now. Thanks! \$\endgroup\$ – Rushyo Aug 15 '10 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.