Introduced new osg::discardDeletedOpenGLObjects() methods, and usage of it in

GrpahicsContext::close() to handle cases where deletingOpenGLObjects is no possible,
such as when GraphicsWindowEmbedded is used.
This commit is contained in:
Robert Osfield
2008-01-08 13:24:29 +00:00
parent f3448d3307
commit ff565128af
27 changed files with 216 additions and 29 deletions

View File

@@ -101,6 +101,8 @@ public:
void flushAllTextureObjects(unsigned int contextID);
void discardAllTextureObjects(unsigned int contextID);
void flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime);
void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; }
@@ -238,6 +240,14 @@ void TextureObjectManager::flushAllTextureObjects(unsigned int contextID)
tol.clear();
}
void TextureObjectManager::discardAllTextureObjects(unsigned int contextID)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
Texture::TextureObjectList& tol = _textureObjectListMap[contextID];
tol.clear();
}
void TextureObjectManager::flushTextureObjects(unsigned int contextID,double currentTime, double& availableTime)
{
// if no time available don't try to flush objects.
@@ -334,6 +344,11 @@ void Texture::flushAllDeletedTextureObjects(unsigned int contextID)
if (getTextureObjectManager()) getTextureObjectManager()->flushAllTextureObjects(contextID);
}
void Texture::discardAllDeletedTextureObjects(unsigned int contextID)
{
if (getTextureObjectManager()) getTextureObjectManager()->discardAllTextureObjects(contextID);
}
void Texture::flushDeletedTextureObjects(unsigned int contextID,double currentTime, double& availbleTime)
{
if (getTextureObjectManager()) getTextureObjectManager()->flushTextureObjects(contextID, currentTime, availbleTime);