HLSL vs GLSL matrix multiplication

So I am converting from DirectX to OpenGL wich means I have to learn OpenGL shading language, everything is so good for now but what I don't understand yet it why on earth the matrix multiplications in GLSL are inverted, in DirectX we multiply the position vector by the World and View and Projection matrices respectively
 
output.Pos = mul( input.Pos, WorldViewProjection ); // pos * World * View * Projection 


but in OpenGL they do the opposite of that:
 
gl_Position = Projection * View * World * Pos;
I don't know much about this stuff, but could it have to do with column vectors vs row vectors?
@dutch is on point here.

The POS is a vector I assume?

In GLSL matrices are filled in column-major order. In HLSL they are row-major order.

Both are valid, but the orientation of what is where is "inverted" in your perspective.

For column-major order, the vector is usually on the right side of the expression, while in row-major order it is usually on the left. This is a much about linear algebra at-large, not just HLSL vs GLSL, but of agreeing on the "standard" of the system.

It makes sense to me now thank you very much guys.

by "inverted" i meant reversed order though.
Last edited on
Topic archived. No new replies allowed.