I just wanted to know if I'm doing this right.  Note that all the matrices are int[16]s.for (int i= 1; i <= 3; i++){    for (int j= 1; j <= 3; j++){        int sum = 0;        for (int h = 1; h <= 3; h++){           sum = sum + position[i*4+h]*projection[h*4+j];        }        modelview[i*4+j] = sum;    }}
Am I multiplying two matrices together correctly?
c++;matrix
No. Let's first look at it as two dimensional arrays, so we know what we're talking about:int i[4][4];int j[4][4];int k[4][4];for (int x = 0; x < 4; x++) { // row number of output    for (int y = 0; y < 4; y++) { // column number of output        k[x][y] = 0;        for (int z = 0; z < 4; z++) { // four elements are added for this output            k[x][y] += i[x][z] * j[z][y];        }    }}Important difference!!! We start at 0 for the indices!Now I'll convert it to int[16]s for you assuming that i[1] is the second element of the first row:int i[16];int j[16];int k[16];for (int x = 0; x < 4; x++) { // row number of output    for (int y = 0; y < 4; y++) { // column number of output        k[4*x+y] = 0;        for (int z = 0; z < 4; z++) { // four elements are added for this output            k[4*x+y] += i[4*x+z] * j[4*z+y];        }    }}This is equivalent to your code except for the fact that you start at 1 instead of zero.