Can the same texture be bound to more than one framebuffer object? I need to write on some texture in a multi target rendering pass with a certain fbo, and later to add some blending to just one of those texture, so I need a second framebuffer object with that texture bound to.
Asked
Active
Viewed 2,030 times
1 Answers
8
I have no idea why you would think that you can't attach a texture to multiple FBOs. So yes, you can.
However, you shouldn't need to for your purposes. You don't have to write to all of the images attached to an FBO. You control what images get written to with glDrawBuffers
. You can even selectively enable and disable blending to certain draw buffers, if you need to write to multiple buffers but only blend with certain ones.
So yes you can, but you shouldn't bother. Just switch your draw buffers, unless you need a new depth buffer or something.

Nicol Bolas
- 449,505
- 63
- 781
- 982
-
1What if I want to read from a texture bound to the same FBO I am writing to? Let's say I have my FBO with TextureA and TextureB, bound to it. I want to blend TextureB on TextureA. It's ok if I just change glDrawBuffers to render only on TextureA? In other words, can I read from a texture when I am writing on an FBO to which such texture is bound, if I don't write to that specific texture? – darius Aug 11 '13 at 05:04
-
@darius: That's an entirely new question. So use the Ask a Question button to ask it. Or just [look up the answer on the OpenGL Wiki](https://www.opengl.org/wiki/Memory_Model#Framebuffer_objects). – Nicol Bolas Aug 11 '13 at 07:08