- Timestamp:
- 12/26/06 21:26:16 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osghangglide/osghangglide.cpp
r5373 r5851 11 11 #include <osgDB/ReadFile> 12 12 13 #include <osgGA/AnimationPathManipulator> 14 15 #include <osgProducer/Viewer> 13 #include <osgViewer/Viewer> 16 14 17 15 #include "GliderManipulator.h" 16 17 #include <iostream> 18 18 19 19 extern osg::Node *makeTerrain( void ); … … 112 112 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 113 113 114 osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(2); 115 osg::Referenced::setThreadSafeReferenceCounting(true); 116 114 117 // construct the viewer. 115 osg Producer::Viewer viewer(arguments);118 osgViewer::Viewer viewer; 116 119 117 // set up the value with sensible default event handlers.118 viewer.setUpViewer(osgProducer::Viewer::ESCAPE_SETS_DONE);119 120 120 unsigned int pos = viewer.addCameraManipulator(new GliderManipulator()); 121 viewer.selectCameraManipulator(pos); 122 123 // get details on keyboard and mouse bindings used by the viewer. 124 viewer.getUsage(*arguments.getApplicationUsage()); 121 viewer.setCameraManipulator(new GliderManipulator()); 125 122 126 123 // if user request help write it out to cout. … … 147 144 viewer.setSceneData( rootnode ); 148 145 146 // set up the value with sensible default event handlers. 147 viewer.setUpViewAcrossAllScreens(); 149 148 150 149 // create the windows and run the threads. … … 153 152 while( !viewer.done() ) 154 153 { 155 // wait for all cull and draw threads to complete.156 viewer.sync();157 158 // update the scene by traversing it with the the update visitor which will159 // call all node update callbacks and animations.160 viewer.update();161 162 154 // fire off the cull and draw traversals of the scene. 163 155 viewer.frame(); 164 156 165 157 } 166 167 // wait for all cull and draw threads to complete before exit.168 viewer.sync();169 170 // run a clean up frame to delete all OpenGL objects.171 viewer.cleanup_frame();172 173 // wait for all the clean up frame to complete.174 viewer.sync();175 158 176 159 return 0;
