From 084a24e958bbd7a040c3dafd09f74bb9e1c334ce Mon Sep 17 00:00:00 2001 From: frohlich Date: Fri, 9 Nov 2007 05:55:50 +0000 Subject: [PATCH] Improove texture sharing. --- simgear/scene/model/model.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index 8a08e73a..749b45c3 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -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 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(); -- 2.39.5