Hi Guy,

If you are using multiple graphics contexts then by default the
OSG/OpenGL will be creating OpenGL objects (like textures) on a per
context basis.  So one osg::Texture in the scene graph even if it's
rendered on two contexts you'll have two separate
TextureObjects/OpenGL texture objects.

As Jason mentions OpenGL and the OSG has support for sharing GL
objects between contexts, but there is no threading protection for
this so you'd have to render the two context single
threaded/sequentially.   There are also limits from the GL driver in
what type of contexts can be shared.

When using pbuffers for RTT the OSG will be default share the GL
objects and this is safe as the parent GraphicsWindow that requires
the RTT will have a it's GraphicsThread release the GraphicsWindow
context, make the pbuffer context current, do the RTT rendering,
release the pbuffer context, then make the original GraphicsWindow
context current again and then finishes rendering.  With this usage it
provides the two contexts are manage single threaded and everything is
safe.

In your own app the answer is likely to be just accept the duplication
of texture objects/VBO's/display lists, or run single threaded and
share GL objects between contexts via the GraphicsContext::Traits set
up, or avoid using multiple windows.  The OSG allows you to have
multiple Camera's and View's on a single window, and it's only a high
level viewer configuration change to swap between a single Context
with multiple Cameras/Views or one using multiple contexts.

Robert.

On Thu, Dec 2, 2010 at 10:18 PM, Guy Volckaert
<[email protected]> wrote:
> I have a newby question to ask... so please be gentil....
>
> Let's say I have 2 cameras running in different draw threads. Each camera is 
> also associated with a different graphic context. If I load a 2D texture then 
> each context will have its own opengl texture object (created in the 
> Texture2D::Apply() function).  So far so good...
>
> My question is: will the opengl driver have 2 instance of the texture object 
> in memory and therefore occuping twice the amount necessary? Or is the driver 
> smart enough to somehow share the same memory space for both instances?
>
> I guess the answer is that each texture is represented in each graphic 
> context by a different opengl texture object, and thus will occupy N times 
> the required memory space, where N is the number of graphic context. Am I 
> understanding this right?
>
> Regards,
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34460#34460
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to