View Full Version : how can i multiply a vertex coord by a matrix in a vp?

09-14-2004, 10:52 AM
hi, i need to multiply a vertex's texture coordinates by the texture matrix in order to make projective texturing in a vertex program. The problem is that i have little knowledge about matrix math and i don't know how to do the multiplication of a vector by a matrix, can someone help me, please?

09-14-2004, 11:15 AM
hey jcabeleira, maybe something like this:


ATTRIB tc = vertex.texcoord[?];
TEMP result;
PARAM texMat[4] = { state.matrix.texture[?] };

# matrix multiply is just 4 dot products
# tc (row) into each texture matrix column
DP4 result.x, tc, texMat[0];
DP4 result.y, tc, texMat[1];
DP4 result.z, tc, texMat[2];
DP4 result.w, tc, texMat[3];

...hope this helps!