From fdc7d225a0d92240ee88b7c88ce34f381f0d2941 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 4 Apr 2018 12:26:53 +0100 Subject: [PATCH] Added -4 command line entry that creates two seperate windows within CompositeViewer --- .../osgcompositeviewer/osgcompositeviewer.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/examples/osgcompositeviewer/osgcompositeviewer.cpp b/examples/osgcompositeviewer/osgcompositeviewer.cpp index 3e664d325..4a2394f5c 100644 --- a/examples/osgcompositeviewer/osgcompositeviewer.cpp +++ b/examples/osgcompositeviewer/osgcompositeviewer.cpp @@ -198,6 +198,46 @@ int main( int argc, char **argv ) } + + if (arguments.read("-4")) + { + + // view one + { + osgViewer::View* view = new osgViewer::View; + view->setName("View one"); + viewer.addView(view); + + view->setUpViewInWindow(0, 0, 800, 600); + view->setSceneData(scene.get()); + view->setCameraManipulator(new osgGA::TrackballManipulator); + + // add the state manipulator + osg::ref_ptr statesetManipulator = new osgGA::StateSetManipulator; + statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet()); + + view->addEventHandler( statesetManipulator.get() ); + } + + // view two + { + osgViewer::View* view = new osgViewer::View; + view->setName("View two"); + viewer.addView(view); + + view->setUpViewInWindow(1000, 0, 800, 600); + view->setSceneData(scene.get()); + view->setCameraManipulator(new osgGA::TrackballManipulator); + + view->addEventHandler( new osgViewer::StatsHandler ); + + + // add the handler for doing the picking + view->addEventHandler(new PickHandler()); + } + } + + if (arguments.read("-3") || viewer.getNumViews()==0) {