I have a float[16] matrix named matrixA. Now I am searching for the matrix named matrixB. This:

glLoadMatrixf(matrixB);
glMultMatrixf(matrixA);

should be the same as:

glLoadIdentity();

How do I get the second matrix (the one first loaded).

Second question:

Is there somewhere a tutorial how to translate and rotate without OpenGL with float[16] matrices which I can load later with glLoadMatrixf? Till know I used float[3][3]s (only rotation), but they are not supported by OpenGL and I want to put the translation into the matrix now too.

BA == I - Remove A from left side by multiplying with A^-1, on both sides, to the right
BAA^-1 == IA^1
B == A^-1

So, there’s your unknown matrix. matrixB is the inverse of matrixA.

For your own rotation matrices, there’s no difference with OpenGL’s 4x4 matrices. It’s well explained in no-one’s link above. But in short, if you have your rotation matrix like this

[ a d g ]
[ b e h ]
[ c f i ]

then just pad with some extra zeros and ones. This 4x4 matrix will do the same thing, and is perfectly valid in OpenGL.

Even though you said the question was for no-one, I answer it anyway

I don’t know if you must transpose it matrix before you upload it to OpenGL, but it should be easy to find out. Upload a translation matrix, and see what happens. If you get some strange result (i.e. not a translation), the elements are obvisouly in the wrong order. Then you must transpose the matrix. You can either do that manually, as your described with your code, or you can let OpenGL do it for you.

Use the extensions GL_ARB_transpose_matrix, or if you have OpenGL 1.2, you don’t need the extensions since it’s added into the core. glLoadTransposeMatrix/glMultTransposeMatrix will load/multiply a matrix whose element are tranposed.