# Why do we multiply perspective * modelview * point?

A common line in vertex shaders is:

gl_Position = projection_matrix * model_view_matrix * object_space_vertex;


I've seen this a lot, why isn't it written like

gl_Position = object_space_vertex * model_view_matrix * projection_matrix;


?

That would be more intuitive I suppose. Is it mathematically wrong?

Yes, it isn't what we want to do. Matrix multiplication is not communative, which is to say that switching the order produces different things.

Think of it this way, if you do these operations:

• Turn left 90 degrees
• Go forward 10 meters

You end up at a different position then if you did:

• Go forward 10 meters
• Turn left 90 degrees

This doesn't mean it's mathematically wrong, you could very well have a need for doing it in a different order, it's just that for this thing we want to do P*M*O and not some other order.