Reputation: 7324
Can I attach two textures to one FBO, and switch between them using glDrawBuffers
, binding the inactive one as shader input? This seems much more efficient than switching FBOs for multipass effects.
Upvotes: 0
Views: 51
Reputation: 473302
If we're assuming you don't have access to OpenGL 4.5/ARB/NV_texture_barrier, no you cannot. The part of the OpenGL specification that forbids feedback loops on framebuffer attached images does not care whether the image can be written to or not. This is also true for array layers or mipmap levels; reading from one layer while writing to another layer will not save you.
All that matters is attachment. You must either bind a new FBO that doesn't have the texture attached, or remove the attachment from the current FBO.
Though again, texture barrier functionality makes everything I said irrelevant. And considering how widespread it is, it's really not something you should be concerned about.
Upvotes: 2