]> git.mxchange.org Git - simgear.git/commitdiff
Improove texture sharing.
authorfrohlich <frohlich>
Fri, 9 Nov 2007 05:55:50 +0000 (05:55 +0000)
committerfrohlich <frohlich>
Fri, 9 Nov 2007 05:55:50 +0000 (05:55 +0000)
simgear/scene/model/model.cxx

index 8a08e73a9645a77c213022170bcc9adc9f08d2ac..749b45c3f7d2a023a85f9b908f01a0c0c00e8db8 100644 (file)
@@ -136,6 +136,9 @@ public:
     if (!texture)
       return;
     
+    // Hmm, true??
+    texture->setDataVariance(osg::Object::STATIC);
+
     osg::Image* image = texture->getImage(0);
     if (!image)
       return;
@@ -379,6 +382,7 @@ SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv, int)
   osg::Image* image = osgDB::readImageFile(path);
   osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
   texture->setImage(image);
+  texture->setDataVariance(osg::Object::STATIC);
   if (wrapu)
     texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
   else
@@ -408,7 +412,7 @@ SGLoadTexture2D(const std::string& path, bool wrapu, bool wrapv, int)
 
     // OSGFIXME: don't forget that mutex here
     osgDB::Registry* registry = osgDB::Registry::instance();
-    registry->getOrCreateSharedStateManager()->share(tmpNode.get(), 0);
+    registry->getSharedStateManager()->share(tmpNode.get(), 0);
 
     // should be the same, but be paranoid ...
     stateSet = tmpNode->getStateSet();