From 6acd657a05b8dfb5a4491de871fdbf51404bcfe5 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 12 Nov 2009 10:58:42 +0100 Subject: [PATCH] Attach an empty shader program to the scene graph root 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Main/renderer.cxx b/src/Main/renderer.cxx index ece25ec32..cfe5f29a3 100644 --- a/src/Main/renderer.cxx +++ b/src/Main/renderer.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -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); }