I just happened to forgot it, could you post the code.
I store the matrix in an array:
GLfloat matrix[16];
I just happened to forgot it, could you post the code.
I store the matrix in an array:
GLfloat matrix[16];
i guess from the 16 elements your using a 4 by 4 matrix, the code for that is avaliable along with a definition a bit like the one you put there from the Game tutorials at http://nehe.gamedev.net/
The method his using I already know, I want the algoritm, you know, using loops to multiply.
Thanks anyway.
Maybe it’ll help you!
void MultiplyMatrix (GLfloat *n1, GLfloat *n2, GLfloat *result) {
register GLbyte l, c, a;
GLshort lc;
for (l=0; l<=3; l++) {
for (c=0; c<=3; c++) {
lc = l*c;
for (a=0; a<=3; a++)
result[(lc)+c] += n1[(lc)+a] * n2[c + (a*4)];
}
}
}