FBO: Attach renderbuffers/textures to default FBO

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…

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.

Yes that’s what I meant. I still manage to confuse myself with the lingo. :slight_smile: 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. :slight_smile: