Show
Ignore:
Timestamp:
01/08/07 11:00:16 (7 years ago)
Author:
robert
Message:

Ported following examples to osgViewer:

osggeodemo
osggeometry
osghud
osgimpostor
osgkeyboard
osglauncher
osglight
osglightpoint
osglogicop
osglogo
osgmovie
osgmultiplecameras
osgmultitexture
osgoccluder
osgparametric
osgparticle

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgimpostor/osgimpostor.cpp

    r5381 r5927  
    1010#include <osgDB/ReadFile> 
    1111 
    12 #include <osgProducer/Viewer> 
     12#include <osgViewer/Viewer> 
    1313 
    1414#include "TestManipulator.h" 
     
    219219    osg::ArgumentParser arguments(&argc,argv); 
    220220 
    221     // set up the usage document, in case we need to print out how to use this program. 
    222     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use impostors - hierachical image cache."); 
    223     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    224     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    225  
    226221    // construct the viewer. 
    227     osgProducer::Viewer viewer(arguments); 
    228  
    229     // set up the value with sensible default event handlers. 
    230     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    231      
     222    osgViewer::Viewer viewer; 
     223 
    232224    // add local test manipulator more suitable for testing impostors. 
    233     unsigned int pos = viewer.addCameraManipulator(new TestManipulator); 
    234     viewer.selectCameraManipulator(pos); 
    235      
    236     // get details on keyboard and mouse bindings used by the viewer. 
    237     viewer.getUsage(*arguments.getApplicationUsage()); 
    238  
    239     // if user request help write it out to cout. 
    240     if (arguments.read("-h") || arguments.read("--help")) 
    241     { 
    242         arguments.getApplicationUsage()->write(std::cout); 
    243         return 1; 
    244     } 
    245  
    246     // any option left unread are converted into errors to write out later. 
    247     arguments.reportRemainingOptionsAsUnrecognized(); 
    248  
    249     // report any errors if they have occured when parsing the program aguments. 
    250     if (arguments.errors()) 
    251     { 
    252         arguments.writeErrorMessages(std::cout); 
    253         return 1; 
    254     } 
     225    viewer.setCameraManipulator(new TestManipulator); 
    255226 
    256227 
     
    318289    viewer.setSceneData(model); 
    319290 
    320     // register trackball, flight and drive. 
    321  
    322     // create the windows and run the threads. 
    323     viewer.realize(); 
    324  
    325     while( !viewer.done() ) 
    326     { 
    327         // wait for all cull and draw threads to complete. 
    328         viewer.sync(); 
    329  
    330         // update the scene by traversing it with the the update visitor which will 
    331         // call all node update callbacks and animations. 
    332         viewer.update(); 
    333           
    334         // fire off the cull and draw traversals of the scene. 
    335         viewer.frame(); 
    336          
    337     } 
    338      
    339     // wait for all cull and draw threads to complete. 
    340     viewer.sync(); 
    341  
    342     // run a clean up frame to delete all OpenGL objects. 
    343     viewer.cleanup_frame(); 
    344  
    345     // wait for all the clean up frame to complete. 
    346     viewer.sync(); 
    347  
    348     return 0; 
     291    return viewer.run(); 
    349292}