Ported following examples to osgViewer:

osggeodemo
    osggeometry
    osghud
    osgimpostor
    osgkeyboard
    osglauncher
    osglight
    osglightpoint
    osglogicop
    osglogo
    osgmovie
    osgmultiplecameras
    osgmultitexture
    osgoccluder
    osgparametric
    osgparticle
This commit is contained in:
Robert Osfield
2007-01-08 10:00:16 +00:00
parent e041f08b73
commit dfb21cb81a
79 changed files with 259 additions and 1191 deletions

View File

@@ -13,11 +13,11 @@
#include <osgGA/TrackballManipulator>
#include <osgProducer/Viewer>
#include <osgViewer/Viewer>
#include <osg/Math>
#include <iostream>
// This demos uses the illustrates how to creates the various different types of geometry that
// the osg::Geometry class can represent. This demos uses the OpenGL red books diagram of different
@@ -638,46 +638,8 @@ osg::Node* createBackground()
return transform;
}
int main( int argc, char **argv )
int main(int, char **)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to create osg::Geometry.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer.
osgProducer::Viewer viewer(arguments);
// set up the value with sensible default event handlers.
viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);
// get details on keyboard and mouse bindings used by the viewer.
viewer.getUsage(*arguments.getApplicationUsage());
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occured when parsing the program aguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
// create the model
osg::Group* root = new osg::Group;
root->addChild( createScene() );
@@ -685,35 +647,10 @@ int main( int argc, char **argv )
//osgDB::writeNodeFile(*root,"geoemtry.osg");
osgViewer::Viewer viewer;
// add model to viewer.
viewer.setSceneData( root );
// create the windows and run the threads.
viewer.realize();
while( !viewer.done() )
{
// wait for all cull and draw threads to complete.
viewer.sync();
// update the scene by traversing it with the the update visitor which will
// call all node update callbacks and animations.
viewer.update();
// fire off the cull and draw traversals of the scene.
viewer.frame();
}
// wait for all cull and draw threads to complete.
viewer.sync();
// run a clean up frame to delete all OpenGL objects.
viewer.cleanup_frame();
// wait for all the clean up frame to complete.
viewer.sync();
return 0;
return viewer.run();
}