]> git.mxchange.org Git - flightgear.git/commitdiff
Attach an empty shader program to the scene graph root
authorTim Moore <timoore@redhat.com>
Thu, 12 Nov 2009 09:58:42 +0000 (10:58 +0100)
committerTim Moore <timoore@redhat.com>
Sun, 20 Dec 2009 09:34:07 +0000 (10:34 +0100)
This establishes a default state of using the OpenGL fixed function pipeline.
Otherwise a shader program from a state set can leak into state sets that don't
use shaders at all.

src/Main/renderer.cxx

index ece25ec32772076e4ca5c9c2eb865b23fd01c8d4..cfe5f29a398375d357de90ab72bb2b6b1ca735a4 100644 (file)
@@ -47,6 +47,7 @@
 #include <osg/Notify>
 #include <osg/PolygonMode>
 #include <osg/PolygonOffset>
+#include <osg/Program>
 #include <osg/Version>
 #include <osg/TexEnv>
 
@@ -552,6 +553,10 @@ FGRenderer::init( void )
     // as the rest of the scene. This may not be true in practice.
     mRealRoot->addChild(thesky->getCloudRoot());
     mRealRoot->addChild(FGCreateRedoutNode());
+    // Attach empty program to the scene root so that shader programs
+    // don't leak into state sets (effects) that shouldn't have one.
+    stateSet = mRealRoot->getOrCreateStateSet();
+    stateSet->setAttributeAndModes(new osg::Program, osg::StateAttribute::ON);
 }