Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Is it possible to clear specific textures attached to FBO's outputs.

  1. #1

    Is it possible to clear specific textures attached to FBO's outputs.

    I'm thinking about reducing number of FBOs, and for that I have to use first 5 texture (texture A) outputs for first 3 draw passes that happen for several objects, and then using another texture (texture B) to save the results.

    I would like to know whether it would be possible to clear the texture A, without clearing texture B. I know that the glClear function clears all (active?) textures attached to the FBO. However, if all the textures I use are already attached to the FBO, I would need to make sure that texture B is not touched when I need to clear texture A.

    Is there a way to diactivate a texture output so that it's not affected by glClear when needed?

    I guess, one way to solve this problem would be to detach/attach texture B, so that it's not affected by glClear. But I believe that would defeat the purpose, since the FBO would have to be re-verified after I do that, which is time consuming. (I've read that somewhere). Is this correct?


    Would calling glDrawBuffers to activate specific attachments before calling glClear do the trick?

    So something like:
    Code :
    glDrawBuffers(texture A attachment number)
    glDrawBuffers(texture B attachment number)
    Last edited by CaptainSnugglebottom; 06-14-2017 at 11:08 PM.

  2. #2
    Member Regular Contributor
    Join Date
    Jul 2012
    Try the approaches given in this thread.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    If you have ARB_clear_texture you could use that:

Posting Permissions

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