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/osggeometry/osggeometry.cpp

    r5381 r5927  
    1414#include <osgGA/TrackballManipulator> 
    1515 
    16 #include <osgProducer/Viewer> 
     16#include <osgViewer/Viewer> 
    1717 
    1818#include <osg/Math> 
    1919 
    20  
     20#include <iostream> 
    2121 
    2222// This demos uses the illustrates how to creates the various different types of geometry that 
     
    639639} 
    640640 
    641  
    642  
    643  
    644 int main( int argc, char **argv ) 
     641int main(int, char **) 
    645642{ 
    646     // use an ArgumentParser object to manage the program arguments. 
    647     osg::ArgumentParser arguments(&argc,argv); 
    648  
    649     // set up the usage document, in case we need to print out how to use this program. 
    650     arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to create osg::Geometry."); 
    651     arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    652     arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    653  
    654     // construct the viewer. 
    655     osgProducer::Viewer viewer(arguments); 
    656  
    657     // set up the value with sensible default event handlers. 
    658     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    659  
    660     // get details on keyboard and mouse bindings used by the viewer. 
    661     viewer.getUsage(*arguments.getApplicationUsage()); 
    662  
    663     // if user request help write it out to cout. 
    664     if (arguments.read("-h") || arguments.read("--help")) 
    665     { 
    666         arguments.getApplicationUsage()->write(std::cout); 
    667         return 1; 
    668     } 
    669  
    670     // any option left unread are converted into errors to write out later. 
    671     arguments.reportRemainingOptionsAsUnrecognized(); 
    672  
    673     // report any errors if they have occured when parsing the program aguments. 
    674     if (arguments.errors()) 
    675     { 
    676         arguments.writeErrorMessages(std::cout); 
    677         return 1; 
    678     } 
    679      
    680  
    681643    // create the model 
    682644    osg::Group* root = new osg::Group; 
     
    686648    //osgDB::writeNodeFile(*root,"geoemtry.osg"); 
    687649 
     650    osgViewer::Viewer viewer; 
    688651 
    689652    // add model to viewer. 
    690653    viewer.setSceneData( root ); 
    691654 
    692     // create the windows and run the threads. 
    693     viewer.realize(); 
    694  
    695     while( !viewer.done() ) 
    696     { 
    697         // wait for all cull and draw threads to complete. 
    698         viewer.sync(); 
    699  
    700         // update the scene by traversing it with the the update visitor which will 
    701         // call all node update callbacks and animations. 
    702         viewer.update(); 
    703           
    704         // fire off the cull and draw traversals of the scene. 
    705         viewer.frame(); 
    706          
    707     } 
    708      
    709     // wait for all cull and draw threads to complete. 
    710     viewer.sync(); 
    711  
    712     // run a clean up frame to delete all OpenGL objects. 
    713     viewer.cleanup_frame(); 
    714  
    715     // wait for all the clean up frame to complete. 
    716     viewer.sync(); 
    717  
    718     return 0; 
     655    return viewer.run(); 
    719656}