Show
Ignore:
Timestamp:
12/26/06 21:26:16 (7 years ago)
Author:
robert
Message:

Ported osghangglider example to usg osgViewer

Files:
1 modified

Legend:

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

    r5373 r5851  
    1111#include <osgDB/ReadFile> 
    1212 
    13 #include <osgGA/AnimationPathManipulator> 
    14  
    15 #include <osgProducer/Viewer> 
     13#include <osgViewer/Viewer> 
    1614 
    1715#include "GliderManipulator.h" 
     16 
     17#include <iostream> 
    1818 
    1919extern osg::Node *makeTerrain( void ); 
     
    112112    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    113113 
     114    osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(2); 
     115    osg::Referenced::setThreadSafeReferenceCounting(true); 
     116 
    114117    // construct the viewer. 
    115     osgProducer::Viewer viewer(arguments); 
     118    osgViewer::Viewer viewer; 
    116119 
    117     // set up the value with sensible default event handlers. 
    118     viewer.setUpViewer(osgProducer::Viewer::ESCAPE_SETS_DONE); 
    119120 
    120     unsigned int pos = viewer.addCameraManipulator(new GliderManipulator()); 
    121     viewer.selectCameraManipulator(pos); 
    122  
    123     // get details on keyboard and mouse bindings used by the viewer. 
    124     viewer.getUsage(*arguments.getApplicationUsage()); 
     121    viewer.setCameraManipulator(new GliderManipulator()); 
    125122 
    126123    // if user request help write it out to cout. 
     
    147144    viewer.setSceneData( rootnode ); 
    148145 
     146    // set up the value with sensible default event handlers. 
     147    viewer.setUpViewAcrossAllScreens(); 
    149148 
    150149    // create the windows and run the threads. 
     
    153152    while( !viewer.done() ) 
    154153    { 
    155         // wait for all cull and draw threads to complete. 
    156         viewer.sync(); 
    157  
    158         // update the scene by traversing it with the the update visitor which will 
    159         // call all node update callbacks and animations. 
    160         viewer.update(); 
    161           
    162154        // fire off the cull and draw traversals of the scene. 
    163155        viewer.frame(); 
    164156         
    165157    } 
    166      
    167     // wait for all cull and draw threads to complete before exit. 
    168     viewer.sync(); 
    169  
    170     // run a clean up frame to delete all OpenGL objects. 
    171     viewer.cleanup_frame(); 
    172  
    173     // wait for all the clean up frame to complete. 
    174     viewer.sync(); 
    175158 
    176159    return 0;