How about just trimming off any invalid characters from the name returned by
glGetActiveUniform?
e.g.
_extensions->glGetActiveUniform( _glProgramHandle,
i, maxLen, 0, &size, &type, name );
for (GLsizei j = 0; j < maxLen && name[j]; ++j)
{
if (!isalnum(name[j]) && name[j] != '_')
{
name[j] = '\0';
break;
}
}
On 9 December 2010 18:46, Glenn Waldron <[email protected]> wrote:
> Hi Robert,
>
> I would like to re-raise the issue of uniform array naming, now that it is
> affecting me personally :)
> To recap:
>
> I have a uniform array in a shader defined as:
>
> uniform bool positions[1];
>
> osg::Program calls glGetActiveUniform() to build a mapping of compiled
> uniforms by name. On some systems, the name returned is "positions" and on
> others it is "positions[0]". When the latter happens, a corresponding
> osg::Uniform named "positions" will fail since it cannot find a matching
> uniform location in the mapping (since it's filed under "positions[0]").
>
> I am not convinced that this is a driver bug. It seems more like an
> ambiguity. The docs say that the 'uniform location for "positions" and
> "positions[0]" are the same; they point to the first element of the array.'
>
> (opengl.org/wiki/G...<http://www.opengl.org/wiki/GLSL_Uniform#Uniform_management>).
> I don't see anything that says the value returned from glGetActiveUniform()
> must be one or the other.
>
> If both names are valid and equivalent, shouldn't we account for both
> possibilities in osg::Program? I suppose you could just alter
> getUniformLocation(...) to check for both variations.
>
> Here are the past threads on the topic. The issue crops up on both ATI and
> NVIDIA systems.
>
> http://markmail.org/thread/5mans4howfbu2qtg
> http://forum.openscenegraph.org/viewtopic.php?t=1828
>
> System: WinXP 32, ATI HD5550/10.11, OSG SVN.
>
> Thanks.
>
>
> Glenn Waldron : Pelican Mapping
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org