what I really want to know is what’s the function of the texture matrix?

for example:

If I have associated the 3D-texture coordinates with each vertex (for instance, vertex A, B,C, D) of the polygon and set the texture matrix M, then opengl would generate the texture coordinates of every point that locates in the rectangle like this?

(x’, y’,z’, w) = M(x, y, z, 1)

(x’’, y’’, z’’)=(x’/w, y’/w, z’/w)

The texture matrix (one per texture unit) pre-multiplies the glTexCoord before using them for lookup.

Texture matrices are the identity matrix per default, so glTexCoords go through as sent to OpenGL.

They are standard 4x4 matrices like the other matrices in OpenGL and you can do the same things with them, only on texture coordinates.

For example you could animate a scrolling texture on an object by using wrap modes and a changing glTranslate in the texture matrix, or you can use perspective projected textures for light and shadow mapping, or use it for basis translations for texture local space bumbmapping, or other endless possibilities.