diff --git a/src/osg/Program.cpp b/src/osg/Program.cpp index c37d42a4e..8cb978f35 100644 --- a/src/osg/Program.cpp +++ b/src/osg/Program.cpp @@ -34,6 +34,8 @@ #include #include +#include + using namespace osg; /////////////////////////////////////////////////////////////////////////// @@ -733,6 +735,15 @@ void Program::PerContextProgram::linkProgram(osg::State& state) _extensions->glGetActiveUniform( _glProgramHandle, i, maxLen, 0, &size, &type, name ); + int pos = strlen(name); + if (pos>0 && name[pos-1]==']') + { + // need to trim [..] from end of name as some drivers append this causing problems with look up. + --pos; + while(pos>0 && name[pos]!='[') { --pos; } + name[pos] = 0; + } + GLint loc = _extensions->glGetUniformLocation( _glProgramHandle, name ); if( loc != -1 )