Changeset 5923 for OpenSceneGraph/trunk/examples/osgcopy/osgcopy.cpp
- Timestamp:
- 01/06/07 22:35:57 (6 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/examples/osgcopy/osgcopy.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgcopy/osgcopy.cpp
r5381 r5923 10 10 #include <osgDB/WriteFile> 11 11 12 #include <osg Producer/Viewer>12 #include <osgViewer/Viewer> 13 13 14 14 #include <osgUtil/Optimizer> 15 15 16 using namespace osg; 16 #include <iostream> 17 17 18 18 // Customize the CopyOp so that we add our own verbose … … 133 133 osg::ArgumentParser arguments(&argc,argv); 134 134 135 // set up the usage document, in case we need to print out how to use this program.136 arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of deep vs shallow vs custom copying of scene graphs.");137 arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");138 arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");139 140 135 // initialize the viewer. 141 osgProducer::Viewer viewer(arguments); 142 143 // if user request help write it out to cout. 144 if (arguments.read("-h") || arguments.read("--help")) 145 { 146 arguments.getApplicationUsage()->write(std::cout); 147 return 1; 148 } 149 150 // any option left unread are converted into errors to write out later. 151 arguments.reportRemainingOptionsAsUnrecognized(); 152 153 // report any errors if they have occured when parsing the program aguments. 154 if (arguments.errors()) 155 { 156 arguments.writeErrorMessages(std::cout); 157 return 1; 158 } 159 160 if (arguments.argc()<=1) 161 { 162 arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 163 return 1; 164 } 136 osgViewer::Viewer viewer; 165 137 166 138 // load the nodes from the commandline arguments. … … 168 140 if (!rootnode) 169 141 { 142 osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl; 170 143 return 1; 171 144 } … … 232 205 viewer.setSceneData(rootnode); 233 206 234 // create the windows and run the threads. 235 viewer.realize(); 236 237 while( !viewer.done() ) 238 { 239 // wait for all cull and draw threads to complete. 240 viewer.sync(); 241 242 // update the scene by traversing it with the the update visitor which will 243 // call all node update callbacks and animations. 244 viewer.update(); 245 246 // fire off the cull and draw traversals of the scene. 247 viewer.frame(); 248 249 } 250 251 // wait for all cull and draw threads to complete. 252 viewer.sync(); 253 254 // run a clean up frame to delete all OpenGL objects. 255 viewer.cleanup_frame(); 256 257 // wait for all the clean up frame to complete. 258 viewer.sync(); 259 260 return 0; 207 return viewer.run(); 261 208 }
