
glUniformMatrix4 with count > 1
Posted Thursday, 13 May, 2010 - 17:19 by tksuoran inWhat is a correct and best way to upload Matrix4[] with a single GL call?
GL class has three versions of UniformMatrix4:
- Single[] value
- ref Single value
- Single* value
I understand that the first version safely fixes the whole array passed to it, but it is not convenient to convert Matrix[] to Single[].
For the second version, I have no idea what really gets fixed and what not. If I pass in ref matrix4array[0].Row0.X, does the whole array really get fixed or not?
Currently I am using the last version, with my own version of UniformMatrix4 that takes in ref Matrix4[] matrix, and which uses fixed (float* matrix_ptr = &matrix[0].Row0.X). I hope this does the right thing, but I wonder if the ref Single value version would work too?
Thanks!


Comments
Re: glUniformMatrix4 with count > 1
The ref Single version should work too.
However, the best solution would be to file a feature request for a proper Matrix4[] overload.