-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stefan Seifert wrote:
> Melchior FRANZ wrote:
>> * Curtis Olson -- Thursday 05 April 2007:
>>> It really looks like it might be some sort of osg bug (or possibly
>>> our usage of osg?) 
>> Yes. I can confirm the bug, even for KSFO:
> 
>>   http://members.aon.at/mfranz/osg-rendering.jpg  [20.0 kB]  
> 
>> So far I could only reproduce if I banked an aircraft quickly. 
> 
> Runway textures are not the only problem. I noticed with different
> aircraft that when banking the terrain textures moved over the terrain.
> 
> Nine
Here's a patch. I suspect a bug in OSG, but it's possible that fgfs is
breaking the graphics state attribute mechanism in some subtle way.

The diff also includes the patch posted to the user mailing list to
compile with the very latest OSG (should work with older versions too).

Tim

- --
Red Hat France SARL, 171 Avenue Georges Clemenceau
92024 Nanterre Cedex, France.
Siret n° 421 199 464 00056
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGFhsyeDhWHdXrDRURAjVfAJ9Yfzg9v1QQ5fSxjaO45XbArXNKnACgiZc3
WkBRSlqvtZc+PIC2zbe5w4M=
=hAx8
-----END PGP SIGNATURE-----
Index: Main/renderer.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Main/renderer.cxx,v
retrieving revision 1.77
diff -d -u -r1.77 renderer.cxx
--- Main/renderer.cxx   1 Mar 2007 18:12:48 -0000       1.77
+++ Main/renderer.cxx   6 Apr 2007 09:59:57 -0000
@@ -49,6 +49,7 @@
 #include <osg/PolygonMode>
 #include <osg/PolygonOffset>
 #include <osg/ShadeModel>
+#include <osg/TexMat>
 #include <osg/TexEnv>
 
 #include <osgUtil/SceneView>
@@ -121,8 +122,9 @@
     stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);
     stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
   }
-  virtual void drawImplementation(osg::State& state) const
+  virtual void drawImplementation(osg::RenderInfo& renderInfo) const
   {
+    osg::State& state = *renderInfo.getState();
     state.pushStateSet(getStateSet());
     state.apply();
     state.setActiveTextureUnit(0);
@@ -184,16 +186,17 @@
 
     stateSet->setTextureAttribute(0, new osg::TexEnv(osg::TexEnv::MODULATE));
   }
-  virtual void drawImplementation(osg::State& state) const
+  virtual void drawImplementation(osg::RenderInfo& renderInfo) const
   {
-    state.pushStateSet(getStateSet());
-    state.apply();
+    osg::State& state = *renderInfo.getState();
+    //state.pushStateSet(getStateSet());
+    //state.apply();
     state.setActiveTextureUnit(0);
     state.setClientActiveTextureUnit(0);
     state.disableAllVertexArrays();
 
-    glPushAttrib(GL_ALL_ATTRIB_BITS);
-    glPushClientAttrib(~0u);
+    glPushAttrib(GL_ALL_ATTRIB_BITS); // XXX Redundant with osg::State
+    glPushClientAttrib(~0u);         // XXX
 
     fgCockpitUpdate(&state);
 
@@ -211,10 +214,12 @@
     glPopClientAttrib();
     glPopAttrib();
 
-    state.popStateSet();
+    //state.popStateSet();
     state.dirtyAllModes();
     state.dirtyAllAttributes();
     state.dirtyAllVertexArrays();
+    // Restore the original state
+    state.apply();
   }
 
   virtual osg::Object* cloneType() const { return new SGHUDAndPanelDrawable; }
@@ -455,6 +460,11 @@
     stateSet = sceneGroup->getOrCreateStateSet();
     stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
     stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
+    // Set a default TexMat to prevent ground textures from sliding
+    // around. This shouldn't be necessary as the default global
+    // attribute has the same effect; either there's a bug in OSG or
+    // fgfs is bypassing the osg::State mechanism somewhere.
+    stateSet->setTextureAttribute(0, new osg::TexMat);
 
     // need to update the light on every frame
     osg::LightSource* lightSource = new osg::LightSource;
Index: Model/panelnode.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Model/panelnode.cxx,v
retrieving revision 1.13
diff -d -u -r1.13 panelnode.cxx
--- Model/panelnode.cxx 7 Jan 2007 19:00:25 -0000       1.13
+++ Model/panelnode.cxx 6 Apr 2007 09:59:57 -0000
@@ -2,6 +2,7 @@
 #  include <config.h>
 #endif
 
+#include <osg/State>
 #include <simgear/compiler.h>
 #include <simgear/structure/exception.hxx>
 
@@ -120,8 +121,9 @@
 }
 
 void
-FGPanelNode::drawImplementation(osg::State& state) const
+FGPanelNode::drawImplementation(osg::RenderInfo& renderInfo) const
 {
+  osg::State& state = *renderInfo.getState();
   osg::ref_ptr<osg::RefMatrix> mv = new osg::RefMatrix;
   mv->set(_xform*state.getModelViewMatrix());
   state.applyModelViewMatrix(mv.get());
Index: Model/panelnode.hxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Model/panelnode.hxx,v
retrieving revision 1.6
diff -d -u -r1.6 panelnode.hxx
--- Model/panelnode.hxx 7 Jan 2007 19:00:25 -0000       1.6
+++ Model/panelnode.hxx 6 Apr 2007 09:59:57 -0000
@@ -33,7 +33,7 @@
 
     FGPanel* getPanel() { return _panel; }
 
-    virtual void drawImplementation(osg::State& state) const;
+    virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
     virtual osg::BoundingBox computeBound() const;
 
 private:
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to