Added releaseGLObjects/resizeGLObjectBuffers support

This commit is contained in:
Robert Osfield
2011-08-26 10:52:25 +00:00
parent 966981f100
commit 0f14f53698
4 changed files with 72 additions and 5 deletions

View File

@@ -355,6 +355,13 @@ ViewDependentShadowMap::ShadowData::ShadowData(ViewDependentShadowMap::ViewDepen
}
}
void ViewDependentShadowMap::ShadowData::releaseGLObjects(osg::State* state) const
{
OSG_INFO<<"ViewDependentShadowMap::ShadowData::releaseGLObjects"<<std::endl;
_texture->releaseGLObjects(state);
_camera->releaseGLObjects(state);
}
///////////////////////////////////////////////////////////////////////////////////////////////
//
// Frustum
@@ -495,6 +502,15 @@ ViewDependentShadowMap::ViewDependentData::ViewDependentData(ViewDependentShadow
_stateset = new osg::StateSet;
}
void ViewDependentShadowMap::ViewDependentData::releaseGLObjects(osg::State* state) const
{
for(ShadowDataList::const_iterator itr = _shadowDataList.begin();
itr != _shadowDataList.end();
++itr)
{
(*itr)->releaseGLObjects(state);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
//
@@ -1769,3 +1785,23 @@ osg::StateSet* ViewDependentShadowMap::selectStateSetForRenderingShadow(ViewDepe
return vdd.getStateSet();
}
void ViewDependentShadowMap::resizeGLObjectBuffers(unsigned int maxSize)
{
// the way that ViewDependentData is mapped shouldn't
}
void ViewDependentShadowMap::releaseGLObjects(osg::State* state) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_viewDependentDataMapMutex);
for(ViewDependentDataMap::const_iterator itr = _viewDependentDataMap.begin();
itr != _viewDependentDataMap.end();
++itr)
{
ViewDependentData* vdd = itr->second.get();
if (vdd)
{
vdd->releaseGLObjects(state);
}
}
}