]> git.mxchange.org Git - simgear.git/commitdiff
Don't use osgDB::SharedStateManager::share in SGLoadTexture2D
authortimoore <timoore>
Fri, 29 Aug 2008 07:39:05 +0000 (07:39 +0000)
committertimoore <timoore>
Fri, 29 Aug 2008 07:39:05 +0000 (07:39 +0000)
It is not safe to call this function from the database pager thread;
in any event, state sets and textures created in the database pager
will get passed through the SharedStateManager anyway.

simgear/scene/model/model.cxx

index aece3e2d77224070fbfb0d9d09ce4356d539c28b..54e749245e5082d575e56467944d5046f8a415db 100644 (file)
@@ -56,26 +56,6 @@ SGLoadTexture2D(bool staticTexture, const std::string& path,
     }
   }
 
-  // Make sure the texture is shared if we already have the same texture
-  // somewhere ...
-  {
-    osg::ref_ptr<osg::Node> tmpNode = new osg::Node;
-    osg::StateSet* stateSet = tmpNode->getOrCreateStateSet();
-    stateSet->setTextureAttribute(0, texture.get());
-
-    // OSGFIXME: don't forget that mutex here
-    osgDB::Registry* registry = osgDB::Registry::instance();
-    registry->getSharedStateManager()->share(tmpNode.get(), 0);
-
-    // should be the same, but be paranoid ...
-    stateSet = tmpNode->getStateSet();
-    osg::StateAttribute* stateAttr;
-    stateAttr = stateSet->getTextureAttribute(0, osg::StateAttribute::TEXTURE);
-    osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(stateAttr);
-    if (texture2D)
-      texture = texture2D;
-  }
-
   return texture.release();
 }