Show
Ignore:
Timestamp:
03/19/03 11:28:19 (12 years ago)
Author:
robert
Message:

Fixed crash in osgoccluder which was calling setUpViewer and the
osgProducer/Viewer was assuming that the update was always set.

Files:
1 modified

Legend:

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

    r1714 r1716  
    291291    osgProducer::Viewer viewer(arguments); 
    292292 
     293    // set up the value with sensible default event handlers. 
     294    viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
     295 
    293296    bool manuallyCreateOccluders = false; 
    294297    while (arguments.read("-c")) { manuallyCreateOccluders = true; } 
    295298 
    296     // register trackball, flight and drive. 
     299    // get details on keyboard and mouse bindings used by the viewer. 
     300    viewer.getUsage(*arguments.getApplicationUsage()); 
    297301 
    298302    // if user request help write it out to cout. 
     
    317321    if (!loadedmodel) 
    318322    { 
    319 //        write_usage(osg::notify(osg::NOTICE),argv[0]); 
    320323        return 1; 
    321324    } 
     
    326329 
    327330    // add the occluders to the loaded model. 
    328     osg::Group* rootnode = NULL; 
     331    osg::ref_ptr<osg::Group> rootnode; 
    329332     
    330333    if (manuallyCreateOccluders) 
     
    340343      
    341344    // add a viewport to the viewer and attach the scene graph. 
    342     viewer.setSceneData( rootnode ); 
     345    viewer.setSceneData( rootnode.get() ); 
    343346 
    344347 
     
    350353        osgUtil::SceneView* sceneview = viewer.getSceneHandlerList()[0].get(); 
    351354     
    352         viewer.getEventHandlerList().push_front(new OccluderEventHandler(sceneview,rootnode)); 
     355        viewer.getEventHandlerList().push_front(new OccluderEventHandler(sceneview,rootnode.get())); 
    353356    } 
    354357 
     
    367370    } 
    368371 
     372    //viewer.sync(); 
     373 
    369374    return 0; 
    370375}