How to clear part of texture buffer
I have a FBO with one texture buffer attached. The idea is to have an atlas of billboards dynamically created and updated, as needed. When one of the sub images in the texture is going to be updated, I need to first clear the old content. What way is best to do that?
One way is to disable depth tests and overwrite with a "blank" bitmap. But it would be inefficient.
Another way would be to use glBlitFramebuffer(). Maybe it is possible to use with mask 0?
Or maybe there is a much better solution available? Obviously, I could have one separate texture for each billboard, but I just have the feeling it would be more efficient with a single atlas.
When you say "one texture buffer" do you mean a "buffer texture", or just a texture?
Sorry, I don't know the definition exactly, but I have glGenTextures() + glTexImage2D() + glFramebufferTexture2D().
Originally Posted by Alfonse Reinheart
So I would say I have a texture, "attached" to an image, and "bound" as a render target in the FBO.
You can attach the texture to a framebuffer, set the scissor in a way that it only covers the area you want to clear using glScissor, then do glClear/glClearBuffer to clear the texture attached to the FBO.
Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
Technical Blog: http://www.rastergrid.com/blog/
Thanks, this was exactly what I was looking for!