View Full Version : Clearing Depth Buffer in FBO

10-10-2007, 03:38 PM
I have an FBO with a couple of color attachments and a depth attachment. My question is, when I call glClear(GL_DEPTH_BUFFER_BIT) how do I know if it's the depth renderbuffer attached to the FBO that's being cleared? (a.k.a. How do I know it's not the default window depth buffer being cleared?)

I've been trying to write a small test program, but so far no luck in figuring out the answer.

10-10-2007, 04:30 PM
When your FBO is bound, glClear will clear its depth-buffer. If no FBO is bound, the window depth buffer is cleared.

You unbind an FBO (and thus make the window buffers current) by calling glBindFramebuffer with the FBO index 0.


10-10-2007, 05:01 PM
Okay, great. That's what I thought. I was just confused by an example program I had found that was calling glClear before the FBO was bound.