Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Clearing Depth Buffer in FBO

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2007
    Posts
    20

    Clearing Depth Buffer in FBO

    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.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: Clearing Depth Buffer in FBO

    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.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2007
    Posts
    20

    Re: Clearing Depth Buffer in FBO

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •