diff --git a/examples/osghangglide/GNUmakefile b/examples/osghangglide/GNUmakefile index 0029def01..445d6c004 100644 --- a/examples/osghangglide/GNUmakefile +++ b/examples/osghangglide/GNUmakefile @@ -18,7 +18,7 @@ HEADERFILES = \ terrain_normals.h\ terrain_texcoords.h\ -LIBS += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osghangglide/GNUmakefile.inst b/examples/osghangglide/GNUmakefile.inst index 04c1ec0a6..0c38b1bc6 100644 --- a/examples/osghangglide/GNUmakefile.inst +++ b/examples/osghangglide/GNUmakefile.inst @@ -12,7 +12,7 @@ CXXFILES =\ terrain.cpp\ trees.cpp\ -LIBS += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgViewer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) EXEC = osghangglide diff --git a/examples/osghangglide/GliderManipulator.cpp b/examples/osghangglide/GliderManipulator.cpp index 565930ac7..2cb3b2bd0 100644 --- a/examples/osghangglide/GliderManipulator.cpp +++ b/examples/osghangglide/GliderManipulator.cpp @@ -87,6 +87,7 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) { switch(ea.getEventType()) { +#if 0 case(GUIEventAdapter::PUSH): { @@ -101,7 +102,7 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) addMouseEvent(ea); us.requestContinuousUpdate(true); - if (calcMovement()) us.requestRedraw(); + // if (calcMovement()) us.requestRedraw(); return true; } @@ -110,7 +111,7 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) addMouseEvent(ea); us.requestContinuousUpdate(true); - if (calcMovement()) us.requestRedraw(); + // if (calcMovement()) us.requestRedraw(); return true; } @@ -119,11 +120,11 @@ bool GliderManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) addMouseEvent(ea); us.requestContinuousUpdate(true); - if (calcMovement()) us.requestRedraw(); + // if (calcMovement()) us.requestRedraw(); return true; } - +#endif case(GUIEventAdapter::KEYDOWN): if (ea.getKey()==' ') { @@ -258,6 +259,8 @@ bool GliderManipulator::calcMovement() float dx = _ga_t0->getXnormalized(); float dy = _ga_t0->getYnormalized(); + + // osg::notify(osg::NOTICE)<<"dx = "< #include -#include - -#include +#include #include "GliderManipulator.h" +#include + extern osg::Node *makeTerrain( void ); extern osg::Node *makeTrees( void ); extern osg::Node *makeTank( void ); @@ -111,17 +111,14 @@ int main( int argc, char **argv ) arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); + osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(2); + osg::Referenced::setThreadSafeReferenceCounting(true); + // construct the viewer. - osgProducer::Viewer viewer(arguments); + osgViewer::Viewer viewer; - // set up the value with sensible default event handlers. - viewer.setUpViewer(osgProducer::Viewer::ESCAPE_SETS_DONE); - unsigned int pos = viewer.addCameraManipulator(new GliderManipulator()); - viewer.selectCameraManipulator(pos); - - // get details on keyboard and mouse bindings used by the viewer. - viewer.getUsage(*arguments.getApplicationUsage()); + viewer.setCameraManipulator(new GliderManipulator()); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) @@ -146,32 +143,18 @@ int main( int argc, char **argv ) viewer.setSceneData( rootnode ); + // set up the value with sensible default event handlers. + viewer.setUpViewAcrossAllScreens(); // 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 before exit. - 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; }