Added more comprehensive releaseGLObjects(State*=0) throughout Nodes,
Drawables,StateSet, and osgDB::Registry. Added cleanup_frame() from to osgProducer::OsgCamerGroup to help with proper clean of OpenGL objects before exit, and modified osgviewer, osghangglider, osgwindows examples to do the extra frame call to cleanup_frame() before exit.
This commit is contained in:
@@ -644,3 +644,23 @@ void OsgCameraGroup::frame()
|
||||
CameraGroup::frame();
|
||||
}
|
||||
|
||||
void OsgCameraGroup::cleanup_frame()
|
||||
{
|
||||
// first relase all GL objects and switch on the flush of deleted objects
|
||||
// in the next frame.
|
||||
for(SceneHandlerList::iterator itr = _shvec.begin();
|
||||
itr != _shvec.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->getSceneView()->releaseAllGLObjects();
|
||||
(*itr)->setFlushOfAllDeletedGLObjectsOnNextFrame(true);
|
||||
}
|
||||
|
||||
// make sure that the registry all flushes all its texture objects.
|
||||
osgDB::Registry::instance()->releaseGLObjects();
|
||||
|
||||
// then run the frame to do the actuall OpenGL clean up.
|
||||
frame();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user