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.
Damon source share