PDA

View Full Version : 4x4



grimoire
05-25-2004, 07:07 PM
I am reading Opengl Programming guide and on Chapter 3 I understand all of it. Except for this 4x4 matrix they keep talking about. I know about translating and rotating and scaleing but then I get to the GlMultMatrix function Could you describe this for me please?

CrazyButcher
05-25-2004, 11:16 PM
with that command you can specify a matrix which is multiplied on top of your current matrix.

e.g.
when you do things like glRotate...
it will create a rotationMatrix and do automatically:

currentMatrix = currentMatrix * rotationMatrix

if you have your own 4x4 matrix and want it to be used, you do glMultMatrix(ownMatrix)

currentMatrix = currentMatrix * ownMatrix

currentMatrix is whatever glMatrixMode your in at the time calling the command.
like Modelview matrix, or texture matrix...

every vertex you have is multipiled with those matrices to produce the "final position" on your screen. with a 4x4 matrix you can do all those transformations, like rotate, scale... and many more =)

4x4 means you have 4 rows and 4 columns in the matrix, ie a square of 16 float values.

search the web on matrix math, homogenous space and so on, if you want to know more about the math behind it.