- Timestamp:
- 01/08/07 11:00:16 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osglightpoint/osglightpoint.cpp
r5381 r5927 1 1 #include <osg/GL> 2 #include <osg Producer/Viewer>2 #include <osgViewer/Viewer> 3 3 4 4 #include <osg/MatrixTransform> … … 19 19 #include <osgSim/LightPointNode> 20 20 21 21 #include <iostream> 22 22 23 23 #define INTERPOLATE(member) lp.member = start.member*rstart + end.member*rend; … … 190 190 int main( int argc, char **argv ) 191 191 { 192 193 192 // use an ArgumentParser object to manage the program arguments. 194 193 osg::ArgumentParser arguments(&argc,argv); … … 201 200 202 201 // construct the viewer. 203 osgProducer::Viewer viewer(arguments); 204 205 // set up the value with sensible default event handlers. 206 viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 207 208 // get details on keyboard and mouse bindings used by the viewer. 209 viewer.getUsage(*arguments.getApplicationUsage()); 202 osgViewer::Viewer viewer; 210 203 211 204 // if user request help write it out to cout. … … 219 212 while (arguments.read("--sprites")) { usePointSprites = true; }; 220 213 221 // any option left unread are converted into errors to write out later.222 arguments.reportRemainingOptionsAsUnrecognized();223 224 // report any errors if they have occured when parsing the program aguments.225 if (arguments.errors())226 {227 arguments.writeErrorMessages(std::cout);228 return 1;229 }230 231 214 osg::Group* rootnode = new osg::Group; 232 215 … … 243 226 viewer.setSceneData( rootnode ); 244 227 245 // create the windows and run the threads. 246 viewer.realize(); 247 248 while( !viewer.done() ) 249 { 250 // wait for all cull and draw threads to complete. 251 viewer.sync(); 252 253 // update the scene by traversing it with the the update visitor which will 254 // call all node update callbacks and animations. 255 viewer.update(); 256 257 // fire off the cull and draw traversals of the scene. 258 viewer.frame(); 259 260 } 261 262 // wait for all cull and draw threads to complete. 263 viewer.sync(); 264 265 // run a clean up frame to delete all OpenGL objects. 266 viewer.cleanup_frame(); 267 268 // wait for all the clean up frame to complete. 269 viewer.sync(); 270 271 return 0; 272 } 228 return viewer.run(); 229 }
