* operator for vector-matrix multiplication

I’ve been having issues with transformations using the * operator between a mat4 and a vec4. I have isolated all matrix transformations in a ‘mul’ function and discovered that these two implementations give different results (as seen from the result of the transformations on the scene):


vec4 mul1(mat4 matrix, vec4 vector)
{
  return matrix * vector; // Doesn't do the expected transformation
}

vec4 mul2(mat4 matrix, vec4 vector)
{
  return vector * transpose(matrix); // Does the expected transformation
}

It was my understanding that OpenGL should consider the vector as a column vector in the first case and as a row vector in the second case. Because of this, I was expecting those two functions to be equivalent (apart for the row/column-ness of the resulting vector, but that should be ignored…?). I even confirmed this using Maple and didn’t see anything to indicate that the * operator behaves differently in the GLSL spec.

This is in a #version 140 shader using the latest drivers for my nvidia card.

Any idea what I am missing here?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.