tags:

views:

192

answers:

1

Or put in other words: Are different framebuffer objects different opengl contexts?

If so, I could render the different FBO's in different threads and pass them once they are rendered off-screen to the main thread that will actually draw them in the screen context. Is it possible?

Thanks

+1  A: 

You can, if the two FBO were created in 2 different context.

However, compositing them together on screen in one window will require passing them back to software and then back to hardware in the window's context. This will be slower than just rendering them both in the main context on one thread.

You're better off focusing on getting the rendering into a single thread if it's going to be in one window, and putting your focus on threading elsewhere. Culling and physics are great places to thread (if you have those), but for rendering, one thread per context is the basic rule of thumb (and each window will pretty much mean one context).

Reed Copsey
But if there is a FBO rendering an interactive command-line (in opengl) and another FBO rendering a very heavy scene, it might be the only option that allows usability of the comman-line, is it right? THanks!
alvatar
Isn't there a way to share textures between different contexts?
Maurice Gilden
@ShadowIce: No. A differt context could easily be sitting on a different graphics card (physically), so the texture will be duplicated and loaded once per context. The OGL texture is created from a context.
Reed Copsey
@Alvaro: Even a large scene should render reasonably. If you're trying to render something huge, I'd split your command prompts into a separate window. Otherwise, render that in a separate context, and overlay, but the rendering in the context with your huge scene is going to be tied to that scene
Reed Copsey
@Reed: Thanks! I don't completely understand "the context with your huge scene is going to be tied to that scene". You mean that I render that normally and then I use another thread for the overlay?
alvatar
@Alvaro: Your overlay scene, which would be your command prompt, will only be drawn on-screen at the same time as your main scene. This is what I meant by it being tied. If you're main scene can only do 0.5fps, your command prompt will be limited to that, even if it was on a separate thread.
Reed Copsey
@ShadowIce, Reed: yes, you can share textures between contexts - use wglShareLists() or see the "share" parameter to glXCreateContext(). So long as you are able to hardware render to a texture that remains in texture memory, then compositing will be fast.
Daniel Paull