I’ve been trying to compute my texture coordinates for shadow mapping by setting the following matrix on the texture matrix stack:
ScaleBias * Projection * View * Model * v
The problem I’m having is that the texture matrix is behaving differently than the modelview matrix. I decided to try to compare rendering normally using the modelview matrix, and the texture matrix.
This works:
// Associated vertex shader is gl_Position = gl_ModelViewMatrix * gl_Vertex;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMultMatrixf(Projection);
glMultMatrixf(View);
glMultTransposeMatrixf( trackball.GetMatrix() );
glutSolidTeapot(3.0f);
This only seems to apply the trackball matrix:
// Associated vertex shader is: gl_Position = gl_TextureMatrix[0] * gl_Vertex;
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMultMatrixf(Projection);
glMultMatrixf(View);
glMultTransposeMatrixf( trackball.GetMatrix() );
glutSolidTeapot(3.0f);
Is there something special about the texture matrix?