Please make FBOs shared across different contexts

Managing FBOs in a program with multiple contexts is painful. On Windows I create an OpenGL context on a hidden window and switch back to this when calling FBO commands. (On Mac, an OpenGL context on a hidden window is invalid, but FBOs do appear to be shared across contexts.) Things would be much more straightforward if FBOs were shared across contexts like VBOs, textures, and shaders are.

There is a really simple, nasty API reason that FBO's are not shareable across contexts: using and editing them is binding them. Specifically, if FBO's where cross-context there are icky things where context A edits the FBO (by changing attachments or changing to what buffers to render) and context B is rendering using that same FBO. One can declare that FBO edits from another thread and context do not take effect until rebind, but that just adds more ickiness in the long run.

The reason that FBOs are not shared is that they are container objects only. But the renderbuffer or texture objects representing the buffers are shared.

Just create FBOs for each context and attach the shared renderbuffer/texture objects.

That is a data management nightmare. What would I do, have an std::map as a member of my render buffer class with a VBO for each context...binding textures each time a new context/vbo combo is encountered. That would be a horrible mess.

One can declare that FBO edits from another thread and context do not take effect until rebind, but that just adds more ickiness in the long run.

I never render multiple contexts simultaneously. Didn't even know it was possible.