# Could someone please explain post/pre multiplication of matrices?

After calling glMultMatrix(m), is m pre or post-multiplied with the current matrix?
i.e.
current_matrix = m * current_matrix
or
current_matrix = current_matrix * m

*** Can you please point me to the paragraph in the OpenGL spec where pre-or-post multiplication is specified?

This is very important when developing a driver. Thank you all for your help!

If you first translate by (50, 50) and then scale by two, you effectively translate by (50, 50) times two, i.e. (100, 100).

What you seem to need is to first scale by two (to have thing twice the size, but not yet moved or rotated) and only thereafter rotate and translate (without scaling affecting the translation), i.e.

[ 2 0 0 ] [ 0.707 0.707 0 ] [ 1.414 1.414 0 ]
[ 0 2 0 ] x [ -0.707 0.707 0 ] = [ -1.414 1.414 0 ]
[ 0 0 1 ] [ 50.000 50.000 1 ] [ 50.000 50.000 1 ]

Thanks EthanStark. I also found the answer I was looking in the OpenGL spec 1.3, paragraph 2.10.2:

…"
If C is the current matrix and M is the matrix pointed to by MultMatrix’s argument,
then the resulting current matrix, C’, is
C’ = C * M:
"…

Q.E.D.

[QUOTE=EthanStark;1287809]If you first translate by (50, 50) and then scale by two, you effectively translate by (50, 50) times two, i.e. (100, 100).

What you seem to need is to first scale by two (to have thing twice the size, but not yet moved or rotated) and only thereafter rotate and translate (without scaling affecting the translation), i.e.

[ 2 0 0 ] [ 0.707 0.707 0 ] [ 1.414 1.414 0 ]
[ 0 2 0 ] x [ -0.707 0.707 0 ] = [ -1.414 1.414 0 ]
[ 0 0 1 ] [ 50.000 50.000 1 ] [ 50.000 50.000 1 ][/QUOTE]

[QUOTE=dlk5730;1287808]After calling glMultMatrix(m), is m pre or post-multiplied with the current matrix?
i.e.
current_matrix = m * current_matrix
or
current_matrix = current_matrix * m
[/quote]
The latter (post-multiplied).

For the OpenGL 1.0 specification, it’s in §2.9.2, p25:

MultMatrix takes the same type argument as LoadMatrix, but multiplies the current matrix by the one pointed to and replaces the current matrix with the product. If C is the current matrix and M is the matrix pointed to by MultMatrix’s argument, then the resulting current matrix, C’, is

C’ = C·M.

Thanks GClements. I concur with your answer. It’s neat that we both found the same answer in different versions of the spec. Cheers!

[QUOTE=GClements;1287812]The latter (post-multiplied).

For the OpenGL 1.0 specification, it’s in §2.9.2, p25:[/QUOTE]