PDA

View Full Version : FBO: Attach renderbuffers/textures to default FBO



wien
12-24-2009, 04:19 AM
Hello. I'm wondering if it's possible to somehow add buffers to the default FBO, the one created by the context (name 0), after the fact? Say I've created a context with a single RGBA8 colour attachment and wanted to add a depth buffer. Would I then have to tear down the context and start again, or is there a way to add buffers to the default FBO like you can with custom FBOs?

D3D10 has this ability and I've kind of built my API abstraction with this assumption in mind, but if this is not possible in OpenGL I might have to rethink a few things...

Dark Photon
12-24-2009, 08:41 AM
Hello. I'm wondering if it's possible to somehow add buffers to the default FBO, the one created by the context (name 0), after the fact?
By buffers, you mean attachments? If so, then no, I don't think so.

This is easily remedied by having an off-screen FBO be your primary draw surface, and then you just blit stuff to the on-screen window FBO when you need to display.

wien
12-24-2009, 03:54 PM
Yes that's what I meant. I still manage to confuse myself with the lingo. :) But, yeah. Rendering to an offscreen texture and blitting to the real backbuffer before swapping is what I ended up doing. Works a treat as far as I can tell, but it does feel slightly clunky.

In the real world though I'll probably end up doing something similar as part of tone mapping an HDR framebuffer, so there won't be any superfluous blits in that case.

Thank you. :)