Seems other people have had the same issue as me: http://forum.openscenegraph.org/viewtopic.php?t=7287
Are there any plans to address the issue in an upcoming release? Alex From: Pecoraro, Alexander N Sent: Wednesday, October 26, 2011 2:17 PM To: OpenSceneGraph Users Subject: RE: EXTERNAL: Re: [osg-users] Draw Elements Instanced Shader Help I think I figured it out. When it links my program for some reason it uses the names InstancePositions[0] and InstanceScales[0] when it builds its _uniformInfoMap in the function linkeProgram(). It obtains the names of the uniforms that my program uses via glGetActiveUniform() (see snippet from Program.cpp below): Program::PerContextProgram::linkProgram(osg::State& state) { ... for( GLint i = 0; i < numUniforms; ++i ) { _extensions->glGetActiveUniform( _glProgramHandle, i, maxLen, 0, &size, &type, name ); GLint loc = _extensions->glGetUniformLocation( _glProgramHandle, name ); if( loc != -1 ) { _uniformInfoMap[Uniform::getNameID(reinterpret_cast<const char*>(name))] = ActiveVarInfo(loc,type,size); OSG_INFO << "\tUniform \"" << name << "\"" << " loc="<< loc << " size="<< size << " type=" << Uniform::getTypename((Uniform::Type)type) << std::endl; } } ... } The value of name that is returned is InstancePositions[0] and InstanceScales[0] - instead of just InstancePositions and InstanceScales (without the square brackets) in my scene graph's StateSet. So when it comes time to apply the uniforms it can't find a mapping from my StateSet's Uniform to the Program's list of uniforms because the names differ. Is that normal behavior for glActiveUniform to return array names with square brackets appended? Alex From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Martz Sent: Wednesday, October 26, 2011 1:55 PM To: OpenSceneGraph Users Subject: EXTERNAL: Re: [osg-users] Draw Elements Instanced Shader Help On 10/26/2011 12:49 PM, Pecoraro, Alexander N wrote: Any idea what I'm doing wrong? Have you tried looking at the osgdrawinstanced example to see how your code differs from functioning code? -- -Paul Martz Skew Matrix Software http://www.skew-matrix.com/
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org