Show
Ignore:
Timestamp:
11/10/05 16:25:06 (8 years ago)
Author:
robert
Message:

Added better control for cancel GraphicsThreads?.

Files:
1 modified

Legend:

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

    r4631 r4732  
    9191}; 
    9292 
     93struct CleanUpOperation : public osg::GraphicsThread::Operation 
     94{ 
     95    CleanUpOperation(osgUtil::SceneView* sceneView): 
     96        osg::GraphicsThread::Operation("CleanUp",false), 
     97        _sceneView(sceneView) 
     98    { 
     99    } 
     100     
     101    virtual void operator () (osg::GraphicsContext*) 
     102    { 
     103        _sceneView->releaseAllGLObjects(); 
     104        _sceneView->flushAllDeletedGLObjects(); 
     105    } 
     106     
     107    osg::ref_ptr<osgUtil::SceneView> _sceneView; 
     108}; 
    93109 
    94110// main does the following steps to create a multi-thread, multiple camera/graphics context view of a scene graph. 
     
    347363 
    348364    } 
     365 
    349366     
    350367    std::cout<<"Exiting application"<<std::endl; 
     368 
     369    // start clean up. 
     370    for(gitr = graphicsContextSet.begin(); 
     371        gitr != graphicsContextSet.end(); 
     372        ++gitr) 
     373    { 
     374        osg::GraphicsContext* context = *gitr; 
     375        osg::GraphicsThread* thread = context->getGraphicsThread(); 
     376        if (thread) 
     377        { 
     378            thread->removeAllOperations(); 
     379            thread->setDone(true); 
     380        } 
     381    } 
     382 
     383    std::cout<<"Removed all operations"<<std::endl; 
    351384 
    352385    return 0;