View Full Version : FBO multiple color attachments and the depth attachment
07-17-2012, 09:28 AM
I could write a small test app but hopefully someone knows:
Just wondering if I have an FBO with multiple color attachments and render to them in sequence if they all share the depth attachment.
Suppose I render a full screen quad at the near clip plane in one attachment and then switch to another attachment and render a cube further back. Should I expect that the cube will not render to the second attachment?
07-17-2012, 10:30 AM
Either you are confused with multiple attachments or I am with how you work with them but if you have multiple attachments at one FBO you draw to all of them at the same time, not in sequence. In case I didn't quite get how you want to use FBOs, please give us some (pseudo) code.
07-17-2012, 11:19 AM
Well, you certainly *can* draw to them in sequence. Perhaps it's a case of 'you shouldn't do that'. If I'm drawing to multiple attachments simultaneously then that makes sense. But I can set the draw buffer to be one attachment then draw something. Then, I can set the draw buffer to another attachment and draw something entirely different. Normally, when drawing to multiple attachments at the same time, you are drawing the same object.
This may be unconventional:
//at this point I have updated the DEPTH_ATTACHMENT with the sphere.
So, I've rendered a sphere to the first color attachment and a cube to the second. Is there any contention with the depth buffer at this point? I would imagine there has to be.
This is probably a case of doing something stupid that shouldn't be done.
07-17-2012, 01:26 PM
It should have the same state it had after drawing the first object. The result in attachment1 should be the same as drawing the sphere with color write off and then drawing the cube.
07-17-2012, 01:59 PM
That's what I thought should happen.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.