Hi Mitch,

osgProducer should manage the sharing of the graphics contexts
autoamtically just be setting the share contexts env var.

 set OSG_SHARE_GRAPHICS_CONTEXTS=ON

Or do it probablically using the Producer  static function:

  Producer::RenderSurface::shareAllGLContexts(true);

Do this before you construct the viewer, and then everything should be
done behind the scenes for you.  When sharing contexts the contextID
is actuall then same for the windows that are sharing OpenGL data.

There is a caveat with sharing though, the windows must be running on
the same GPU, this is an OpenGL implementation limitiation.

The other issue you to tackle is the fact that osgProducer::Viewer
doesn't support multiple indepedent camera manipulators for multiple
indepednet cameras.  Producer does support this by switching off the
sharing of lenses, but once you do this you'll need to manage the
updating of the view matrixes yourself.

Robert.


On 10/16/06, Mitch Patenaude <[EMAIL PROTECTED]> wrote:

Hi.

   I am having a problem with texture when I want to integrate two windows
that shows two different point of view of the same scene.  My scene is
composed of LOD terra page terrain and flt models.  I have an instance of
the producer viewer with a render surface and a camera in each of the
winodws.  I tried everything I could find but I still doesn't work.  I still
have strange texture effect on my second window.

This is what I tried:

    First I tried using the share display list for each of the render
surface:
            mRenderSurface->shareAllGLContexts(true);

   but then I had no texture in second window (everything is white)

   So I implemented my onw way of sharing the texure with wglShareLists:

        HGLRC wThisGLContex = wglGetCurrentContext();
        HGLRC wAnotherGLContex =
SCENE_MGR_PTR->getShareGLContext();
        if(wAnotherGLContex)
          wglShareLists(wAnotherGLContex,wThisGLContex);

       SCENE_MGR_PTR->setShareGLContext(wThisGLContex);

   then I was able to see some texture on my second widow but the texure are
not the good one and I have stange effect....

   Finaly I tried to force the context ID to 0 for the first window and 1
for the second window

    osgProducer::Viewer::SceneHandlerList shl =
mOSGProducerViewer->getSceneHandlerList();
    osgProducer::Viewer::SceneHandlerList::iterator p;
    unsigned int n = 0;
    for( p = shl.begin(); p != shl.end(); p++ )
    {
      int inheritanceMask =
(*p)->getSceneView()->getInheritanceMask();
      inheritanceMask &= ~(osg::CullSettings::CULL_MASK);
      (*p)->getSceneView()->setInheritanceMask(
inheritanceMask );
      (*p)->getSceneView()->setCullMask(DISPLAYED_BY_2D);
      (*p)->setContextID(0);
      n++;
    }

  but that didn't give me any improvement....

  I read somewhere the the database pager might not support two rendering
surface:

http://www.mail-archive.com/[email protected]/msg01449.html

  Is there a way to get it to work?  Does somebody have an Idea???

  Thank you all!

Mitch





_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to