Fixed the TextureObject's + GLBufferObject reassignment to a new set.

Disabled the unref after apply for a Texture classes when the texture pool is enabled
This commit is contained in:
Robert Osfield
2009-10-06 13:42:12 +00:00
parent e6a1429335
commit 69557c060b
9 changed files with 68 additions and 34 deletions

View File

@@ -174,16 +174,10 @@ void GLBufferObject::compileBuffer()
osg::notify(osg::NOTICE)<<"newTotalSize="<<newTotalSize<<", _profile._size="<<_profile._size<<std::endl;
_profile._size = newTotalSize;
if (_set)
{
// remove self from original set
_set->remove(this);
// get the new set for the new profile
_set = _set->getParent()->getGLBufferObjectSet(_profile);
// register self with new set.
_set->addToBack(this);
_set->moveToSet(this, _set->getParent()->getGLBufferObjectSet(_profile));
}
}
@@ -882,6 +876,23 @@ void GLBufferObjectSet::remove(GLBufferObject* to)
}
void GLBufferObjectSet::moveToSet(GLBufferObject* to, GLBufferObjectSet* set)
{
if (set==this) return;
if (!set) return;
// remove 'to' from original set
--_numOfGLBufferObjects;
remove(to);
// register 'to' with new set.
to->_set = set;
++set->_numOfGLBufferObjects;
set->addToBack(to);
}
GLBufferObjectManager::GLBufferObjectManager(unsigned int contextID):
_contextID(contextID),
_numActiveGLBufferObjects(0),