Will OpenGL automatically truncate it or is this an error?
I have a piece of nasty OpenGL code that seems to be setting an array of float4x3 in the program by using glUniform4fv with a big array that has float4 values in it (i.e. 4 floats per row instead of 3), and it seems to work. That is OpenGL only copies 3 values to each row of the matrix and skips the 4th one. Is it OK to assume this will always work?
The GLSL specification is quite clear on this: the size and type for
glUniform*calls must exactly match the size and type declared in the shader (except for samplers and booleans). So if you callglUniform4fv, you must be setting either a single variable of typevec4or an array ofcountentries in an array variable of typevec4.