If both matrices are diagonal, square and have same size, then the multiplication is commutative.
krico
2010-09-20 15:18:52
If both matrices are diagonal, square and have same size, then the multiplication is commutative.
The convention in mathematics (and thus in programming) is that you multiply the vector by a linear transformation from the right: matrix * vector == transformed vector
. So I don't understand you complain. The matrix is already set to the right one. If you want to multiply the vector from the left then you need to transpose the matrix: result = mul(vector, transpose(wvp))
EDIT: OK, Direct3D actually does the opposite. It multiplies vectors from the left (treats them as rows rather than columns). OpenGL, for example, multiplies from the right as normal people do. So you need to load the transposed matrix to the cg program.