Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

Issue

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

Any ideas? Need more code?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
PS: the anti-aliased terrain looks lovely! –  drxzcl Aug 15 '10 at 11:18
    
Yeah, that looks like a classic "didn't clear the buffer" issue. –  JasonD Aug 15 '10 at 11:58
    
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... –  Rushyo Aug 15 '10 at 12:35
    
(Only started playing with OpenGL this week) –  Rushyo Aug 15 '10 at 12:36
    
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! –  Rushyo Aug 15 '10 at 12:40
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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