How to untie texture from frame buffer

I try to map different scenes to a set of textures, each scene has its own texture where it should be drawn ...

Question:

How badly created it would be to say: 512 FBO with 512 textures attached to each of them. Wouldn't it be better to use only one FBO, in which case I would need to untie the texture previously associated with the FBO, how should I do this, or should I stick with 512 FBOs?

+6
source share
2 answers

You detach the attached texture by attaching the null texture to the same connection point (see chapter 4.4 of the specification).

I canโ€™t say for sure whether removing and re-attaching textures will be faster or switching framebuffer objects, as this is implementation dependent.
Conceptually, however, attaching and detaching textures means twice as many library calls, and twice as many frame completeness checks should be made in the driver, so I would suggest that using multiple FBOs would be faster (although 512 is an awesome number!).

However, it is possible that the implementation can perform these checks in a lazy way (at any time after touching any attachment and immediately before the first drawing command), so it is impossible to say for sure.

+4
source

Use only one FBO and attach textures to it. When you attach another texture, the original texture is not bound to FBO.

Alternatively, you can attach texture identifier 0 to the FBO to disconnect the current texture from the FBO.

+5
source

Source: https://habr.com/ru/post/893010/


All Articles