From 3c6b6e4d97612bb7dceb51c8329861ca30bf08e3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 27 May 2008 11:04:52 +0000 Subject: [PATCH] From Stephane Lamoliatte, "Here is a patch that fix the strange bug describe on the osg-user group. Finally it seems to not come from the empty geode. The origin of the problem seems to be the uniform initialization during the building of the program which call a glUseProgram. If your scene never display the node that contains the shader and if there is no other shader on the scene, this "glUseProgram" is the only one that is called during your simulation. So, this shader is applied on all the scene. I fix this bug by switching off the shader (by calling glUseProgram(0) ) during the compilation of a state which does not contain the shader. " --- src/osgUtil/GLObjectsVisitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index 0f86d161d..e2cb46648 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -125,6 +125,12 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) } } } + else if(_renderInfo.getState()->getLastAppliedProgramObject()){ + + GL2Extensions* extensions = GL2Extensions::Get(_renderInfo.getState()->getContextID(), true); + extensions->glUseProgram(0); + _renderInfo.getState()->setLastAppliedProgramObject(0); + } }