Another way you could get matrices into your vertex program is to use glTrackMatrix to track an otherwise unused matrix…like one of the texture matrices.
The only thing that you MUST put into a vertex program is a vertex. You can generate values for everything else within the vertex program.
Yes, your matrix code looks correct and yes you can generate texture coordinates in the vertex program without having them as inputs.
Originally posted by Zeno:
Another way you could get matrices into your vertex program is to use glTrackMatrix to track an otherwise unused matrix…like one of the texture matrices.
glTrackMatrix is a NV_vertex_program function, not a ARB_vertex_program function. If you want to have matrix tracking in ARB_vertex_program, use the state struct (for example to access the modelview projection matrix you would use state.matrix.mvp).
[This message has been edited by jra101 (edited 12-14-2002).]
glMatrixMode( GL_MATRIX0 );
glLoadMatrixfv( mat );
Bind with state.matrix[0].
Note that matrices are internally transposed so that they Do The Right Thing when they get loaded into parameter row vectors. If you load a matrix array into vector registers on your own, you have to also transpose it on your own to have the right thing happen.