Changeset 5851

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

Ported osghangglider example to usg osgViewer

Location:
OpenSceneGraph/trunk/examples/osghangglide
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osghangglide/GNUmakefile

    r2149 r5851  
    1919        terrain_texcoords.h\ 
    2020 
    21 LIBS     += -losgProducer -lProducer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)  
     21LIBS     += -losgViewer -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)  
    2222 
    2323INSTFILES = \ 
  • OpenSceneGraph/trunk/examples/osghangglide/GNUmakefile.inst

    r2149 r5851  
    1313        trees.cpp\ 
    1414 
    15 LIBS     += -losgProducer -lProducer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)  
     15LIBS     += -losgViewer -losgDB -losgText -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)  
    1616 
    1717EXEC = osghangglide 
  • OpenSceneGraph/trunk/examples/osghangglide/GliderManipulator.cpp

    r5371 r5851  
    8888    switch(ea.getEventType()) 
    8989    { 
     90#if 0    
    9091        case(GUIEventAdapter::PUSH): 
    9192        { 
     
    102103            addMouseEvent(ea); 
    103104            us.requestContinuousUpdate(true); 
    104             if (calcMovement()) us.requestRedraw(); 
     105            // if (calcMovement()) us.requestRedraw(); 
    105106            return true; 
    106107        } 
     
    111112            addMouseEvent(ea); 
    112113            us.requestContinuousUpdate(true); 
    113             if (calcMovement()) us.requestRedraw(); 
     114            // if (calcMovement()) us.requestRedraw(); 
    114115            return true; 
    115116        } 
     
    120121            addMouseEvent(ea); 
    121122            us.requestContinuousUpdate(true); 
    122             if (calcMovement()) us.requestRedraw(); 
     123            // if (calcMovement()) us.requestRedraw(); 
    123124 
    124125            return true; 
    125126        } 
    126  
     127#endif 
    127128        case(GUIEventAdapter::KEYDOWN): 
    128129            if (ea.getKey()==' ') 
     
    259260    float dx = _ga_t0->getXnormalized(); 
    260261    float dy = _ga_t0->getYnormalized(); 
     262     
     263    // osg::notify(osg::NOTICE)<<"dx = "<<dx<<" dy = "<<dy<<"dt = "<<dt<<std::endl; 
    261264 
    262265    // mew - flag to reverse mouse-control mapping 
  • 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;