   OpenGL like matrix
  Im trying to make my matrices which are just float[16] to work like they do in OpenGL.For example, if i translate by 5 units in X, my position will be 5,0,0.Y.....O . . . . . @ 5 units to X axisBut if i were to rotate 90 degrees anticlockwise in the Z first and then apply my 5 units of translation, it should end up at 0,5,0. Basically i want my matrices to take into account the past transformations which have occured(and also in the order in which OpenGL does it because im so used to it).   X. 5 units to X axis after rotation.... Y. . . . . . .O . . . . . .Currently my matrix multiplication code doesnt seem to be able to do that. Here is the code: void Renderer::multMat(float* A,float* B,float* P){//Let A and B be our matrices,P will be the result (B x A).P[0] = A[0] * B[0] + A[4] * B[1] + A[8] * B[2] + A[12] * B[3];P[1] = A[1] * B[0] + A[5] * B[1] + A[9] * B[2] + A[13] * B[3];P[2] = A[2] * B[0] + A[6] * B[1] + A[10] * B[2] + A[14] * B[3];P[3] = A[3] * B[0] + A[7] * B[1] + A[11] * B[2] + A[15] * B[3];P[4] = A[0] * B[4] + A[4] * B[5] + A[8] *  B[6] + A[12] * B[7];P[5] = A[1] * B[4] + A[5] * B[5] + A[9] * B[6] + A[13] * B[7];P[6] = A[2] * B[4] + A[6] * B[5] + A[10] * B[6] + A[14] * B[7];P[7] = A[3] * B[4] + A[7] * B[5] + A[11] * B[6] + A[15] * B[7];P[8] = A[0] * B[8] + A[4] * B[9] + A[8] * B[10] + A[12] * B[11];P[9] = A[1] * B[8] + A[5] * B[9] + A[9] * B[10] + A[13] * B[11];P[10] = A[2] * B[8] + A[6] * B[9] + A[10] * B[10] + A[14] * B[11];P[11] = A[3] * B[8] + A[7] * B[9] + A[11] * B[10] + A[15] * B[11];P[12] = A[0] * B[12] + A[4] * B[13] + A[8] * B[14] + A[12] * B[15];P[13] = A[1] * B[12] + A[5] * B[13] + A[9] *B[14] + A[13] * B[15];P[14] = A[2] * B[12] + A[6] * B[13] + A[10] * B[14] + A[14] * B[15];P[15] = A[3] * B[12] + A[7] * B[13] + A[11] * B[14] + A[15] * B[15];}[edited by - GamerSg on February 11, 2004 7:04:48 AM]
  If your matrices are in column-major order (like OpenGL will put them if you retrieve them) then you are calcuating AxB, not BxA. 