Hi,

Instead of trimming [0] from the name, as previously suggested, we should 
detect if a uniform name has it, but add BOTH 'name[0]' and 'name' into 
Program::_uniformInfoMap, so that when the osg::Uniform are applied, there will 
be a name match for whatever the driver returns... Both are actually valid.

The fix I have applied in my osg version, in 
void Program::PerContextProgram::linkProgram(osg::State& state)


// For some drivers, active uniform array names are returned as 'name', and for 
others, 'name[0]'
// The way OSG works is to lookup into the program's active uniforms to see if 
a uniform set in a StateSet 
//   is present, and apply it only in that case. But that mechanic fails if the 
active uniform name
//   includes the backets, but not the other, and vice-versa.  So add both into 
the _uniformInfoMap
//   to fix this, as both names are valid and allowed by OpenGL specifications
std::string strName(name);
if(strName.length() > 3 && strName.substr(strName.length()-3, 3) == 
std::string("[0]"))
  _uniformInfoMap[strName.substr(0, strName.length()-3)] = 
ActiveVarInfo(loc,type,size);


Thank you!

Cheers,
Philippe

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=42287#42287





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to