Added releaseAllGLObjects() convinience method.
This commit is contained in:
parent
1b31024cd5
commit
b9e4235d85
@ -414,6 +414,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
/** Do draw traversal of draw bins generated by cull traversal.*/
|
||||
virtual void draw();
|
||||
|
||||
/** Releast all OpenGL objects from the scene graph, such as texture objects, display lists etc.
|
||||
* These released scene graphs placed in the respective delete GLObjects cache, which
|
||||
* then need to be deleted in OpenGL by SceneView::flushAllDeleteGLObjects(). */
|
||||
virtual void releaseAllGLObjects();
|
||||
|
||||
/** Flush all deleted OpenGL objects, such as texture objects, display lists etc.*/
|
||||
virtual void flushAllDeletedGLObjects();
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <osgUtil/GLObjectsVisitor>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgUtil;
|
||||
@ -88,6 +89,7 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset)
|
||||
}
|
||||
if (_mode&RELEASE_STATE_ATTRIBUTES)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"GLObjectsVisitor::apply"<<std::endl;
|
||||
stateset.releaseGLObjects(_state.get());
|
||||
}
|
||||
}
|
||||
|
@ -614,6 +614,16 @@ void SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod
|
||||
rendergraph->prune();
|
||||
}
|
||||
|
||||
void SceneView::releaseAllGLObjects()
|
||||
{
|
||||
if (!_sceneData) return;
|
||||
|
||||
GLObjectsVisitor globjv(GLObjectsVisitor::RELEASE_DISPLAY_LISTS|GLObjectsVisitor::RELEASE_STATE_ATTRIBUTES);
|
||||
globjv.setNodeMaskOverride(0xffffffff);
|
||||
globjv.setState(_state.get());
|
||||
_sceneData->accept(globjv);
|
||||
}
|
||||
|
||||
|
||||
void SceneView::flushAllDeletedGLObjects()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user