Hi Jeremy, On Wed, Jul 27, 2011 at 2:56 PM, Jeremy Moles <jer...@emperorlinux.com> wrote: > On Wed, 2011-07-27 at 12:06 +0400, Sergey Polischuk wrote: >> Hi Jeremy >> >> You can try to append "[]" to array uniform name string when create >> osg::Uniform, mb this helps. > > It won't because it seems that internally OSG changes: > > Color > > ...to... > > Color[0] > > ...even, on non-array Uniforms. > > If I edit Program.cpp and remove this behavior (that is, the appending > of the "[0]" to uniform names), it works again. This issue was also > discussed briefly here:
The OSG itself won't be appending a "[0]" - there isn't any code in Program.cpp to do this. I have NVidia 270.x drivers on my machine and when I modify Progrgam.cpp to output the result from glGetActiveUniform and run your app the name return is Color, and the glGetUniformLocation() on this succeeds return a 0 and I get a blue sphere as expected from the fragment shader you provided. >From what I can make out from this and the other threads it looks to me like the glGetActiveUniform() uniform is not returning Color, but Color[0], and the the glGetUniformLocation() is failing when using this same name. The OSG isn't modifying the name between glGetActiveUnform and glGetUniformLocation, so it's a case of the OSG just passing along to the driver what the GL driver tells it. If this fails then it rather looks like a driver bug. >From what I can make out glGetUniformLocation works fine on these problem drivers when no [0] is appended. Is this correct? I've done a test on my system with 270 drivers where I append a [0] to the name return from glGtActiveUniform to simulate the issues and it returns a valid location and everything works without problems. The only problem I saw occurred if I used this modified name in the uniform look up map as the OSG would look for the name "Color" while stored in the map was Color[0]. Could it be that this in balance of the stored name of the uniform the OSG uses vs what the uniform name that 275+ drivers return? Robert. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org