Recently, i was learning shadow map. However ,when i was learning the course written by http://www.paulsprojects.net/tutorials/smt/smt.html, i do not understand the operation on the matrix as followed:

T is the texture matrix

Pl is the light’s projection matrix

Vl is the light’s view matrix

Vc is the camera’s view matrix

T=P1xV1xVc-1

this equation transform the camera’s eye space to light’s clip space, ok, i understand how it works. But, in the fellowing code: textureMatrix=biasMatrix*lightProjectionMatrix*lightViewMatrix;

the order of the matrix multiplication is not the same as T=P1xV1xVc-1 ,can somebody explain the meaning of the matrix multiplication?

Following is the corresponding code

//Calculate texture matrix for projection

//This matrix takes us from eye space to the light’s clip space

//It is postmultiplied by the inverse of the current view matrix when specifying texgen

static MATRIX4X4 biasMatrix

(0.5f, 0.0f, 0.0f, 0.0f,

0.0f, 0.5f, 0.0f, 0.0f,

0.0f, 0.0f, 0.5f, 0.0f,

0.5f, 0.5f, 0.5f, 1.0f);

MATRIX4X4 textureMatrix=biasMatrix*lightProjectionMatrix*lightViewMatrix;

//Set up texture coordinate generation.

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

glTexGenfv(GL_S, GL_EYE_PLANE, textureMatrix.GetRow(0));

glEnable(GL_TEXTURE_GEN_S);

glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

glTexGenfv(GL_T, GL_EYE_PLANE, textureMatrix.GetRow(1));

glEnable(GL_TEXTURE_GEN_T);

glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

glTexGenfv(GL_R, GL_EYE_PLANE, textureMatrix.GetRow(2));

glEnable(GL_TEXTURE_GEN_R);

glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

glTexGenfv(GL_Q, GL_EYE_PLANE, textureMatrix.GetRow(3));

glEnable(GL_TEXTURE_GEN_Q);