For glGetUniformfv, documentation states that "To query values stored in uniform variables declared as arrays, call glGetUniform for each element of the array"
Any example/hint on how to do that ?
For glGetUniformfv, documentation states that "To query values stored in uniform variables declared as arrays, call glGetUniform for each element of the array"
Any example/hint on how to do that ?
All you need to know to make this work is that uniform array locations are assigned sequentially beginning with arrayname[0].
For each additional index, you can add 1 to this location. So if you wanted to get the value of arrayname[21], you would find the location of arrayname[0] and then add 21 to that.
GLint arrayname_0 = glGetUniformLocation (program, "arrayname[0]");
GLint arrayname_21 = glGetUniformLocation (program, "arrayname[21]");
assert (arrayname_0 + 21 == arrayname_21);
You could query the location of the 21st element of arrayname the hard way, or you could take advantage of the property mentioned earlier. In any case, if you want to get the value of specific element in a uniform array, this location is the one you need to pass.