Added releaseGLObjects to NodeCallbacks, Drawable::DrawCallbacks and wired up
osgProducer to use it when doing cleanup_frame.
This commit is contained in:
@@ -378,6 +378,11 @@ class OSG_EXPORT Drawable : public Object
|
||||
|
||||
/** do customized draw code.*/
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const { drawImplementation(*renderInfo.getState(), drawable); }
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* =0) const {}
|
||||
};
|
||||
|
||||
/** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/
|
||||
|
||||
@@ -82,6 +82,12 @@ class OSG_EXPORT NodeCallback : public virtual Object {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(State* =0) const {}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -69,7 +69,10 @@ class OSGGA_EXPORT SimpleViewer : public osgGA::GUIActionAdapter, public osg::Re
|
||||
virtual void frameCullTraversal();
|
||||
virtual void frameDrawTraversal();
|
||||
|
||||
/** Clean up all OpenGL objects associated with this viewer scenegraph. Note, must only be called from the graphics context associated with this viewer.*/
|
||||
/** Release all OpenGL objects associated with this viewer's scenegraph. Note, does not deleted the actual OpenGL objects, it just releases them to the pending GL object delete lists which will need flushing once a valid graphics context is obtained.*/
|
||||
virtual void releaseAllGLObjects();
|
||||
|
||||
/** Clean up all OpenGL objects associated with this viewer's scenegraph. Note, must only be called from the graphics context associated with this viewer.*/
|
||||
virtual void cleanup();
|
||||
|
||||
public:
|
||||
|
||||
@@ -305,6 +305,12 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
|
||||
/** Update internal structures w.r.t updated scene data.*/
|
||||
virtual void updatedSceneData();
|
||||
|
||||
/** Dispatch a clean up frame that should be called before closing a OsgCameraGroup, i.e. on exit from an app.
|
||||
* The clean up frame first release all GL objects associated with all the graphics context associated with
|
||||
* the camera group, then runs a special frame that does the actual OpenGL deletion of GL objects for each
|
||||
* graphics context. */
|
||||
virtual void cleanup_frame();
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler
|
||||
void setWriteImageFileName(const std::string& filename);
|
||||
const std::string& getWriteImageFileName() const { return _writeImageFileName; }
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(osg::State* =0) const;
|
||||
|
||||
protected:
|
||||
|
||||
osgProducer::OsgCameraGroup* _cg;
|
||||
|
||||
Reference in New Issue
Block a user