Sam Adamsh
Sam Adamsh

Reputation: 3391

opengl matrix multiplication

If I have a current matrix in OpenGL of C, and I apply the following code:

   glMultMatrixf(M);
   glMultMatrixf(M2);

What does the Current transformation matrix look like? In the red book it states that using glMultMatrix*(M) does this: CM. But also that doing the above makes this happen: M(M2v) where M2 gets applied before M. In this case M would be the left operand, but in the former M is the right operand.

Upvotes: 1

Views: 5082

Answers (1)

Tim
Tim

Reputation: 35943

If you do;

glLoadIdentity();
glMultMatrixf(M1);
glMultMatrixf(M2);
glMultMatrixf(M3);

Then the resulting matrix is M = M1 * M2 * M3;

If you apply a vertex v to this, it is multiplied like so: v' = M*v = M1*M2*M3*v

I don't really understand your confusion though, what is the 'former case' you're referring to?

Upvotes: 4

Related Questions