Elurahu
01-29-2011, 09:04 AM
I'm currently implementing a technique which require rendering to a different texture types and the way I'm currently using the FBO are causing me some issues.
What I want to do:
Use a single FBO bound at the start of the rendering pass to dynamically toggle between a MRT consisting of 3x 2D float textures and a MRT consisting of 3x 3D float textures. The 3D texture needs to be bound as layered textures because I need to be able to address the various layeres from a geometry shader.
When first binding the 3x 2D textures everything is fine, and I'm able to render to them without any issues. But after having the 3D volume texture bound I'm unable to render using the 2D texture at the start of the next rendering pass. The reason being that the FBO now believes it's layered! Shouldn't clearing the attachments I'm using be enough? Are there any reason why clearing an attachment slot doesn't clear the slot state?
Does it even make sense to use a single FBO for this, or just switch to using two seperate? The only reason I'm doing it is because of performence.
- Edit
When detaching attachments from the various color attachment slots is it needed to unbind using exactly the same function as when initially bound? Eg. clearing a slot using glFramebufferTexture2D() which was bound using glFramebufferTexture()?
What I want to do:
Use a single FBO bound at the start of the rendering pass to dynamically toggle between a MRT consisting of 3x 2D float textures and a MRT consisting of 3x 3D float textures. The 3D texture needs to be bound as layered textures because I need to be able to address the various layeres from a geometry shader.
When first binding the 3x 2D textures everything is fine, and I'm able to render to them without any issues. But after having the 3D volume texture bound I'm unable to render using the 2D texture at the start of the next rendering pass. The reason being that the FBO now believes it's layered! Shouldn't clearing the attachments I'm using be enough? Are there any reason why clearing an attachment slot doesn't clear the slot state?
Does it even make sense to use a single FBO for this, or just switch to using two seperate? The only reason I'm doing it is because of performence.
- Edit
When detaching attachments from the various color attachment slots is it needed to unbind using exactly the same function as when initially bound? Eg. clearing a slot using glFramebufferTexture2D() which was bound using glFramebufferTexture()?