View Full Version : multiple contexts and pbuffers
I want to let our application's users choose how many output windows they want to have.
For the resources, it looks like I could first create a pbuffer context and share it with each new context.
Did anyone try that before ? Do you think it will be efficient or will it be slower than managing resources 'manually' ?
The primary platform is windows, but I want it to work also on linux and mac.
09-20-2007, 06:59 AM
If you want cross-platform-ness, use framebuffer objects rather than pbuffers.
The goal of using a pbuffer here is to hold all the textures and other resources in one opengl context, and then share these resources with on-screen rendering contexts that will be created after.
PBOs can not 'hold' data like a context does, and It looks like pbuffers are supported on each platform, aren't they ? (I know they have a different implementation).
09-20-2007, 11:28 AM
The goal of using a pbuffer here is to hold all the textures and other resources in one opengl context, and then share these resources with on-screen rendering contexts that will be created after.You can't create a pbuffer without creating a rendering context to begin with. Which means you're going to need a window somewhere.
Now, I can't say how sharing objects works when the context the shared object was created in goes away. But if it truly is sharing, then the object should only die when all contexts that use the object do.
Do some tests. If the objects are destroyed when the initial context is destroyed, then you'll probably need to use a pbuffer context. But if not, then just use the first window you create to hold the objects. Unless the user can get rid of all windows, in which case you'll need to use the pbuffer to keep them around.
[quote]PBOs can not 'hold' data like a context does/quote]
PBO stands for "pixel buffer object". The correct acronym for framebuffer object is FBO.
09-20-2007, 12:20 PM
Personally, I create a window+context, query the wgl extensions, destroy the context+window, create another small window+context with the wglpixelformat I'm going to use for the other windows, hide this window, then use wglsharelists to share with all subsequently created contexts.
It's always worked fine.
well of course what I meant was fbo, sorry for the typo.
Thanks for your recommendation.
knackered, do you execute any gl command in your hidden window ?
do you mean it's impossible to use wglsharelists when contexts have different pixel formats ?
do you know if there are any performance penalty when wglsharelists is used ?
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.