From: frohlich Date: Sun, 7 Jun 2009 11:50:01 +0000 (+0000) Subject: Do not modify danymically generated textures. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=daa0fbdc6ba4a2c0548d71737953aa0901b5d71d;p=simgear.git Do not modify danymically generated textures. Modified Files: simgear/scene/model/ModelRegistry.cxx --- diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 2e92c836..861aee43 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -258,9 +258,13 @@ public: if (!texture) return; - // Hmm, true?? - texture->setDataVariance(osg::Object::STATIC); + // Do not touch dynamically generated textures. + if (texture->getReadPBuffer()) + return; + if (texture->getDataVariance() == osg::Object::DYNAMIC) + return; + // If no image attached, we assume this one is dynamically generated Image* image = texture->getImage(0); if (!image) return; @@ -285,6 +289,16 @@ public: if (!texture) return; + // Cannot be static if this is a render to texture thing + if (texture->getReadPBuffer()) + return; + if (texture->getDataVariance() == osg::Object::DYNAMIC) + return; + // If no image attached, we assume this one is dynamically generated + Image* image = texture->getImage(0); + if (!image) + return; + texture->setDataVariance(Object::STATIC); } @@ -292,8 +306,8 @@ public: { if (!stateSet) return; - SGTextureStateAttributeVisitor::apply(stateSet); stateSet->setDataVariance(Object::STATIC); + SGTextureStateAttributeVisitor::apply(stateSet); } };