• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualHodgman

Posted 19 May 2013 - 11:54 PM

Row major storage vs column major storage makes absolutely no difference on your maths. The meaning A*B is strictly defined according to mathematical rules. The way that matrices are stored in memory is just an invisible implementation detail.

What does matter though is whether you treat your vectors (vec4, float4, etc) as row-vectors or column-vectors, i.e. is a vec4 a mat1x4 or a mat4x1?

If you write vec * mat, that's the same as mat1x4 * mat4x4.

If you write mat * vec, that's the same as mat4x4 * mat4x1.

These have different mathematical meanings.

Depending on which one of these conventions you use (which is an entirely different issue from column/row-major storage), you will store your values differently inside your matrices.

### #1Hodgman

Posted 19 May 2013 - 11:53 PM

Row major storage vs column major storage makes absolutely no difference on your maths. The meaning A*B is strictly defined according to mathematical rules. The way that matrices are stored in memory is just an invisible implementation detail.

What does matter though is whether you treat your vectors (vec4, float4, etc) as row-vectors or column-vectors, i.e. is a vec4 a mat1x4 or a mat4x1?

If you write vec * mat, that's the same as mat1x4 * mat4x4.

If you write mat * vec, that's the same as mat4x4 * mat4x1.

Depending on which one of these conventions you use (which is an entirely different issue from column/row-major storage), you will store your values differently inside your matrices.

PARTNERS