Show
Ignore:
Timestamp:
08/31/05 22:39:05 (9 years ago)
Author:
robert
Message:

Removed circular reference of osg::CameraNode?, fixing memory leak. Added
a auto exit after a maximum number of frames are completed.

Files:
1 modified

Legend:

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

    r4486 r4488  
    1414 
    1515#include <osgDB/ReadFile> 
     16#include <osgDB/DynamicLibrary> 
     17#include <osgDB/Registry> 
    1618 
    1719#include <map> 
     
    7476    } 
    7577     
    76     osg::ref_ptr<osg::CameraNode>    _camera; 
     78    osg::CameraNode*                 _camera; 
    7779    osg::ref_ptr<osgUtil::SceneView> _sceneView; 
    7880}; 
     
    119121int main( int argc, char **argv ) 
    120122{ 
     123 
    121124    if (argc<2)  
    122125    { 
     
    124127        return 1; 
    125128    } 
     129 
     130    // load the osgProducer library manually. 
     131    osg::ref_ptr<osgDB::DynamicLibrary> osgProducerLib = 
     132            osgDB::DynamicLibrary::loadLibrary(osgDB::Registry::instance()->createLibraryNameForNodeKit("osgProducer")); 
     133 
    126134 
    127135    // load the scene. 
     
    301309    osg::Timer_t previous_tick = start_tick; 
    302310     
    303     bool done = false;     
     311    bool done = false; 
     312    unsigned int maxNumFrames = 500; 
    304313 
    305314    // main loop -  update scene graph, dispatch frame, wait for frame done. 
    306     while( !done ) 
     315    while( !done && frameNum<maxNumFrames) 
    307316    { 
    308317 
     
    335344 
    336345    } 
     346 
     347    // delete the cameras, associated contexts and threads. 
     348    cameraList.clear(); 
     349     
     350    std::cout<<"Exiting application"<<std::endl; 
     351 
    337352    return 0; 
    338353}