| 333 | | osgProducer::Viewer viewer(arguments); |
| 334 | | |
| 335 | | // set up the value with sensible default event handlers. |
| 336 | | viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); |
| 337 | | |
| 338 | | // get details on keyboard and mouse bindings used by the viewer. |
| 339 | | viewer.getUsage(*arguments.getApplicationUsage()); |
| 340 | | |
| 341 | | // if user request help write it out to cout. |
| 342 | | if (arguments.read("-h") || arguments.read("--help")) |
| 343 | | { |
| 344 | | arguments.getApplicationUsage()->write(std::cout); |
| 345 | | return 1; |
| 346 | | } |
| 347 | | |
| 348 | | // any option left unread are converted into errors to write out later. |
| 349 | | arguments.reportRemainingOptionsAsUnrecognized(); |
| 350 | | |
| 351 | | // report any errors if they have occured when parsing the program aguments. |
| 352 | | if (arguments.errors()) |
| 353 | | { |
| 354 | | arguments.writeErrorMessages(std::cout); |
| 355 | | return 1; |
| 356 | | } |
| 357 | | |
| 358 | | if (arguments.argc()<=1) |
| 359 | | { |
| 360 | | arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); |
| 361 | | return 1; |
| 362 | | } |
| 363 | | |
| | 328 | osgViewer::Viewer viewer; |
| 395 | | // create the windows and run the threads. |
| 396 | | viewer.realize(); |
| 397 | | |
| 398 | | while( !viewer.done() ) |
| 399 | | { |
| 400 | | // wait for all cull and draw threads to complete. |
| 401 | | viewer.sync(); |
| 402 | | |
| 403 | | // update the scene by traversing it with the the update visitor which will |
| 404 | | // call all node update callbacks and animations. |
| 405 | | viewer.update(); |
| 406 | | |
| 407 | | // fire off the cull and draw traversals of the scene. |
| 408 | | viewer.frame(); |
| 409 | | |
| 410 | | } |
| 411 | | |
| 412 | | // wait for all cull and draw threads to complete. |
| 413 | | viewer.sync(); |
| 414 | | |
| 415 | | // run a clean up frame to delete all OpenGL objects. |
| 416 | | viewer.cleanup_frame(); |
| 417 | | |
| 418 | | // wait for all the clean up frame to complete. |
| 419 | | viewer.sync(); |
| 420 | | |
| 421 | | return 0; |
| | 359 | osg::notify(osg::NOTICE)<<"Warning: NEED TO IMPLEMENT REQUEST OF STENCIL BUFFER!"<<std::endl; |
| | 360 | |
| | 361 | return viewer.run(); |