Hi Roman,

It could be that the vista drivers don't support sharing contexts.
It also could be that the reuse of the Traits objects for both context
is the problem - I've never tried this and wouldn't recommend it, so
please just use a separate Traits objects.

Sharing contexts is also something the forces a few limits on how you
use the graphics contexts, such as it's only really safe to use them
single threaded.

Robert.

On Fri, Oct 10, 2008 at 10:03 AM, Roman Grigoriev <[EMAIL PROTECTED]> wrote:
> Hi guys
> I try realize simple clone rendering in two windows
> I render scenegraph once then write to texture and show it on 2 windows
> so 1 have 2 windows created like this
>
> osg::ArgumentParser arguments(&argc,argv);
>   osgViewer::CompositeViewer viewer_(arguments);
>  viewer.setThreadingModel(osgViewer::CompositeViewer::ThreadPerContext);
>  osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
> osg::GraphicsContext::Traits;
>  traits->x = 0;
>  traits->y = 0;
>  traits->width =  width;
>  traits->height = height;
>  traits->windowDecoration = false;
>  traits->doubleBuffer = true;
>  traits->sharedContext = 0;
>  traits->screenNum = 0;
> //Create first context and add first View to the composite viewer
>
>   osg::ref_ptr<osg::GraphicsContext> gc1 =
> osg::GraphicsContext::createGraphicsContext(traits.get());
>
>   if(gc1.valid())
>     {
>
>   viewer_.addView(view);
>
>   view->setSceneData(root);
>   colorCamera1=view->getCamera();
>   colorCamera1->setViewport(new osg::Viewport(0,0,
> traits->width,traits->height));
>   //view->getCamera()->setViewport(new osg::Viewport(0,0,
> traits->width,traits->height));
>  //
> view->getCamera()->setProjectionMatrixAsPerspective(45,traits->width/traits-
>>height, 10, 1000000);
>   colorCamera1->setGraphicsContext(gc1.get());
>  //  view->getCamera()->setNearFarRatio(0.5/30000.0);
>     }
>
>
>  traits->x = width;
>  traits->y = 0;
>  traits->sharedContext=gc1.get();
> {
>   osg::ref_ptr<osg::GraphicsContext> gc2 =
> osg::GraphicsContext::createGraphicsContext(traits.get());
>   //gc->createNewContextID();
>   if(gc2.valid())
>     {
>   osgViewer::View* view2 = new osgViewer::View;
>   viewer_.addView(view2);
>
>  // view->addEventHandler(keyboardHandler_.get());
>   view2->setSceneData(cam2node);
> //   view->addEventHandler(MouseFly::Instance());
>   view2->getCamera()->setViewport(new osg::Viewport(0,0, traits->width,
> traits->height));
>   view2->getCamera()->setProjectionMatrixAsPerspective(45,
> traits->width/traits->height, 10, 1000000);
>   view2->getCamera()->setGraphicsContext(gc2.get());
>   view2->getCamera()->setNearFarRatio(0.5/30000.0);
>     }
>  }
>
>  viewer_.realize();
>
>
> so when I set traits->sharedcontext=0 I have 2 separate windows but when I
> set it to gc1.get()
> I have tons of opengl errors on vista osg SVN nvidia 179.13
> Could someone please explain me how to use multicontext windows
> Thanx in advance
> Bye
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to