Serge K:
Is that really the clean way to go? I mean, does C guarantee, that in two dimensional arrays, the “columns” follow without physical memory seams?
BTW, why would you Mult the matrix, then call identity?
Oh, and it is better to do glfloat Matrix[16] As a matter of fact some intresting tricks can be done with this, if you use union. (search the message board, there was a good example of this a few weeks (months?) back.
I never used "d arrayer instead I always used 1d and never had any problems.
If get it to load the check out win32asm.virtualave.net under the programming section for some uses for matrices.
Oh, you wouldn’t need unions to have these cool effects, by the way. You can also set the byte aligning for the structs. Might be a bit unclean, but should work.
If it is written in the RedBook, it rules for OpenGL. Did you ever handle the matrices actually in your own program or are you only using the gl functions?
I’m getting totally confused, actually… Shame on you… Anyway, explain it to me more exactly, please.
My openGL book sais that one should keep in mind that opengl matrices are handled the other way.
Anyway, currently reading Stephen Hawkings short story of time. Seems to be very interresting from what I saw yet…
It interresting me very much if we’re saying the same thing. These are indices of the float[16] array I drew as numbers into the matrix. This is the only logical expression for an opengl matrix, since you can’t tell opengl that you want something to be a row or whatever.
To get clear:
float matrix[16];
A mathematical visual represantation of a matrix, indices are obvious
now, if we do a dump of mat1, like using:
…
text.Draw("%.2f %.2f %.2f %.2f",mat1[0],mat1[1],mat1[2],mat1[3]);
text.Draw("%.2f %.2f %.2f %.2f",mat1[4],mat1[5],mat1[6],mat1[7]);
text.Draw("%.2f %.2f %.2f %.2f",mat1[8],mat1[9],mat1[10],mat1[11]);
text.Draw("%.2f %.2f %.2f %.2f",mat1[12],mat1[13],mat1[14],mat1[15]);
…
would yeild the idenity matrix (say model was at 0,0,0) so the dump would be
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
and if we would translate the model to (-1,2,3) and dump matrix, it would be
1 0 0 0
0 1 0 0
0 0 1 0
-1 2 3 1
and if we truned model around (z axis) the dump would be
1 0 0 0
0 1 0 0
0 0 -1 0
-1 2 3 1
So that means the bottom row tells you where the object is in the world.