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

    r5381 r5927  
    2828#include <osgGA/TrackballManipulator> 
    2929 
    30 #include <osgProducer/Viewer> 
     30#include <osgViewer/Viewer> 
    3131 
    3232#include <osgDB/ReadFile> 
     
    3939public:  
    4040 
    41     PickHandler(osgProducer::Viewer* viewer,osgText::Text* updateText): 
     41    PickHandler(osgViewer::Viewer* viewer,osgText::Text* updateText): 
    4242        _viewer(viewer), 
    4343        _updateText(updateText) {} 
     
    5656protected: 
    5757 
    58     osgProducer::Viewer* _viewer; 
     58    osgViewer::Viewer* _viewer; 
    5959    osg::ref_ptr<osgText::Text>  _updateText; 
    6060}; 
     
    9494std::string PickHandler::pick(float x, float y) 
    9595{ 
     96#if 0 
    9697    osgUtil::IntersectVisitor::HitList hlist; 
    9798    if (_viewer->computeIntersections(x, y, hlist)) 
     
    104105        } 
    105106    } 
     107#else 
     108    osg::notify(osg::NOTICE)<<"Picking not implemented yet "<<x<<", "<<y<<std::endl; 
     109#endif     
    106110    return ""; 
    107111} 
     
    397401     
    398402    // construct the viewer. 
    399     osgProducer::Viewer viewer; 
    400  
    401     // set up the value with sensible default event handlers. 
    402     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    403     
     403    osgViewer::Viewer viewer; 
     404 
    404405    osg::ref_ptr<osgText::Text> updateText = new osgText::Text; 
    405406 
    406407    // add the handler for doing the picking 
    407     viewer.getEventHandlerList().push_front(new PickHandler(&viewer,updateText.get())); 
     408    viewer.addEventHandler(new PickHandler(&viewer,updateText.get())); 
    408409 
    409410    osg::Group* root = new osg::Group(); 
     
    423424    lookAt.makeLookAt(osg::Vec3(0.0f, -4.0f, 0.0f), centerScope, osg::Vec3(0.0f, 0.0f, 1.0f)); 
    424425 
    425     //viewer.setView(lookAt); 
    426          
     426    viewer.getCamera()->setViewMatrix(lookAt); 
     427         
     428    viewer.realize(); 
     429 
    427430    while( !viewer.done() ) 
    428431    { 
    429         // wait for all cull and draw threads to complete. 
    430         viewer.sync(); 
    431  
    432         // update the scene by traversing it with the the update visitor which will 
    433         // call all node update callbacks and animations. 
    434         viewer.update(); 
    435  
    436         // to be able to turn scene, place next call before viewer.update() 
    437         viewer.setView(lookAt); 
    438  
    439      
    440432        // fire off the cull and draw traversals of the scene. 
    441         viewer.frame(); 
    442          
    443     } 
    444      
    445     // wait for all cull and draw threads to complete. 
    446     viewer.sync(); 
    447  
    448     // run a clean up frame to delete all OpenGL objects. 
    449     viewer.cleanup_frame(); 
    450  
    451     // wait for all the clean up frame to complete. 
    452     viewer.sync(); 
     433        viewer.frame();         
     434    } 
    453435 
    454436    return 0;