I was using glUniform3fvARB(location, count, *value); for passing vectors to a vertex shader and i noticed (after a day of banging!) that the vector i was passing was not coming out right in the vertex/fragment shader. I read the documentation (both official and also from the Orange Book) and found that the “count” parameter should be the number of items passed i.e. 1 in case you are passing a 3d vector (i was passing a 3d position vector). But nothing seems to be working right, i tried passing 3 and 1 in case of a 3d vector but the results in both cases were inconsistent (from the ones i was getting while using an equivalent CG shader). Is this a known nVidia issue (i am using the latest drivers). Can someone give me more information on this please.
P.S: I then worked around by passing the parameter as glUniform3fARB(…) and that worked out fine without any change in the vs/ps code, but i want to directly pass an array.
Are you sure both the function pointer queried with wglGetProcAddress and the pointer to your data are correct?
Post the code which fails including the data you give to glUniform3fvARB.
(paramWeights is 0 after the call).
The red component in the fragment shader appears to be 0. If I replace the argument 4 with 3 the red component appears to get the right value 1.
If I try to access the array elements via:
paramWeights=glGetUniformLocationARB(shaderSystem->getHandle(), "weights[0]");
glUniform1fARB(paramWeights,weights[0]);
... and so on for 1..3 ...
the value for weight[0] in the fragment shader changes from 1 to 0 as soon as I set the third array element. Again glGetUniformLocationARB returns i for the index i (i.e. a valid value).