[osg-users] switch between two camera

Ben ben.poulard at gmail.com
Fri Mar 20 08:07:55 PDT 2009


benbao wrote:
> I try to use nodemask but doesn't work.
> Id do this : 
> Code:
> 
> osgViewer::CompositeViewer viewer;
> osgViewer::GraphicsWindowEmbedded* gw = new osgViewer::GraphicsWindowEmbedded;
> 
> osgViewer::View* vue2D = new osgViewer::View;
> osgViewer::View* vue3D = new osgViewer::View;
> viewer.addView(vue2D);
> viewer.addView(vue3D);
> 
> vue2D->getCamera()->setGraphicsContext(gw );
> vue2D->getCamera()->setProjectionMatrixAsPerspective(30.0f, width()/(double) height(), 1.0, 1000.0);
> vue2D->getCamera()->setViewport(new osg::Viewport(0,0,width(),height() ));
> vue2D->setCameraManipulator(new osgGA::TrackballManipulator);
> 
> 
> vue3D->getCamera()->setGraphicsContext(gw );
> vue3D->getCamera()->setProjectionMatrixAsPerspective(30.0f, width()/(double) height(), 1.0, 1000.0);
> vue3D->getCamera()->setViewport(new osg::Viewport(0,0,width(),height() ));
> vue3D->setCameraManipulator(new osgGA::TrackballManipulator);
> 
> 
> 
> Code:
> 
> // to switch vue3D OFF and vue2D on
> vue2D->getCamera()->setNodeMask(0XFFFFFFFF);
> vue3D->getCamera()->setNodeMask(0);
> 
> 
> 


sorry it's work, but only the view on top is updated by mouse manipulator.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8854#8854








More information about the osg-users mailing list