From be47c9f44a8e8cfd3a2f8e03a415c707798decea Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 2 Jun 2009 09:15:03 +0000 Subject: [PATCH] Merged from svn/trunk. --- src/osgUtil/GLObjectsVisitor.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index e2cb46648..df0286e74 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -11,12 +11,18 @@ * OpenSceneGraph Public License for more details. */ #include + #include #include +#include -using namespace osg; -using namespace osgUtil; +namespace osgUtil +{ +///////////////////////////////////////////////////////////////// +// +// GLObjectsVisitor +// GLObjectsVisitor::GLObjectsVisitor(Mode mode) { setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); @@ -45,7 +51,7 @@ void GLObjectsVisitor::apply(osg::Geode& node) for(unsigned int i=0;i(stateset.getAttribute(osg::StateAttribute::PROGRAM)); - if (program) _lastCompiledProgram = program; + if (program) { + if( program->isFixedFunction() ) + _lastCompiledProgram = NULL; // It does not make sense to apply uniforms on fixed pipe + else + _lastCompiledProgram = program; + } if (_lastCompiledProgram.valid() && !stateset.getUniformList().empty()) { @@ -127,7 +138,7 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) } else if(_renderInfo.getState()->getLastAppliedProgramObject()){ - GL2Extensions* extensions = GL2Extensions::Get(_renderInfo.getState()->getContextID(), true); + osg::GL2Extensions* extensions = osg::GL2Extensions::Get(_renderInfo.getState()->getContextID(), true); extensions->glUseProgram(0); _renderInfo.getState()->setLastAppliedProgramObject(0); } @@ -145,6 +156,11 @@ void GLObjectsVisitor::apply(osg::StateSet& stateset) } } +///////////////////////////////////////////////////////////////// +// +// GLObjectsVisitor +// + GLObjectsOperation::GLObjectsOperation(GLObjectsVisitor::Mode mode): osg::GraphicsOperation("GLObjectOperation",false), _mode(mode) @@ -182,3 +198,6 @@ void GLObjectsOperation::operator () (osg::GraphicsContext* context) } // osg::notify(osg::NOTICE)<<"GLObjectsOperation::after >>>>>>>>>>> "<