Ensure a reference on the cube map texture is always held

This commit is contained in:
fredb
2007-01-26 20:30:02 +00:00
parent a6c46c89eb
commit 39f683b272

View File

@@ -126,14 +126,12 @@ private:
static osg::TextureCubeMap*
getOrCreateTextureCubeMap()
{
static osg::TextureCubeMap* textureCubeMap = 0;
if (textureCubeMap)
return textureCubeMap;
static osg::ref_ptr<osg::TextureCubeMap> textureCubeMap;
static SGMutex mutex;
SGGuard<SGMutex> locker(mutex);
if (textureCubeMap)
return textureCubeMap;
if (textureCubeMap.get())
return textureCubeMap.get();
// create and setup the texture object
textureCubeMap = new osg::TextureCubeMap;
@@ -146,7 +144,7 @@ getOrCreateTextureCubeMap()
textureCubeMap->setUpdateCallback(new SGMapGenCallback);
return textureCubeMap;
return textureCubeMap.get();
}
static void create_specular_highlights(osg::Node *node)