# Are there multiple valid definitions for what translate, rotate and scale do?

Are there multiple valid definitions for what translate, rotate and scale do to the 4x4 matrix?

I bring up this question, because I have a simple webgl program that draws a square and does a few translate, rotate, and scale transformations. When I originally wrote the program I was using glMatrix v0.9.5. I upgraded the glMatrix to v2.2 and now the square is in a different position and rotation.

I'm fairly certain I correctly upgraded the program to use the new version, since the program was so small to begin with.

Regardless of what is happening to my program, I'm very interested to know if translate, rotate, and scale have a single universal definition or if different graphics engines / matrix libraries can have different definitions for what the transforms do.

Further details:

No transformations (origin is at the top left corner)

The square program with the following transformations:

translate x: 250, y: 250, z: 0

rotate around Z axis angle: -90

Finally the square program with the following transformations:

translate x: 250, y: 250, z: 0

rotate around Z axis angle: -90

translate x: 150, y: 0, z: 0

• Are the columns and rows swapped in your two different examples? If so, that's not really a change to the way the matrix works, but rather a change of order of operations. Sort of. Dec 20, 2013 at 4:24
• I'm fairly certain they are not swapped. I'm doing a translate, rotate, translate, and rotate to the square and I'm getting a different result with the new version of glMatrix. But if I just do a translate and then a rotate then both versions of glMatrix give the same result. Dec 20, 2013 at 4:28
• Would you edit your question to include your input, the operations, and the different output? Dec 20, 2013 at 4:49
• Looks like possibly in the previous version, the second translate (150, 0, 0) was happening in the rotated coordinate system, i.e. the x-translate would be along the world space y-axis, but now the translate is being applied in world coordinates, so the x-translate is along the x-axis. That is strange, though - with the normal way of combining transforms by multiplying matrices, you would expect the former, i.e. the v0.9.5 behavior seems more correct. Dec 20, 2013 at 5:33
• Instead of or in addition to pictures, post some small code samples. There's a bazillion simple explanations for differing output from similar input. Dec 20, 2013 at 7:37