]> git.mxchange.org Git - simgear.git/commitdiff
Do not modify danymically generated textures.
authorfrohlich <frohlich>
Sun, 7 Jun 2009 11:50:01 +0000 (11:50 +0000)
committerTim Moore <timoore@redhat.com>
Thu, 11 Jun 2009 13:55:11 +0000 (15:55 +0200)
Modified Files:
simgear/scene/model/ModelRegistry.cxx

simgear/scene/model/ModelRegistry.cxx

index 2e92c836ee6364acea6c555831160f0ff1544e4e..861aee432949ac72fc3e28293ff6ca600e351ff0 100644 (file)
@@ -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);
   }
 };