Matricies
Im reading the OpenGL Game Programming book and am a little confused as to exactly what a matix is (besides an array of numbers). I understand the pushing and popping of the stack with relation to the objects, but im a little confused as to what is being stored in the matricies and why I would want to multiply them together to get custom effects.
Please help im lost here
Steve
Its really a lot simpler than it seems. Assuming you understand matrix math, we can multiply a point by a matrix. Now it sounds like your asking why we do that or what does it do.
Well, the matrices you are using are called transformation matrices. When you multiply a point by a transformation matrix it returns a new transformed point.
The numbers inside the matrix are specific to the transformation matrix but here is a trivial example:
Cleary we can translate a point with the following equations:
x'' = x + numUnitsToTranslateOnXAxis;
y'' = y + numUnitsToTranslateOnYAxis;
z'' = z + numUnitsToTranslateOnZAxis;
So to perform a translation transformation we only need to add some translation factor to each component.
Instead of doing the above, it is better to strategically place the translation factors in a matrix so that when the point is multiplied by the matrix the above operations are performed.
You can find a basic translation matrix easily on the web. Do the multplication by hand and you will see it results in the above equations.
To summarize, the numbers inside the matrix are strategically placed so that when a point is multiplied by the matrix the desired transformation is performed.
ECKILLER
Well, the matrices you are using are called transformation matrices. When you multiply a point by a transformation matrix it returns a new transformed point.
The numbers inside the matrix are specific to the transformation matrix but here is a trivial example:
Cleary we can translate a point with the following equations:
x'' = x + numUnitsToTranslateOnXAxis;
y'' = y + numUnitsToTranslateOnYAxis;
z'' = z + numUnitsToTranslateOnZAxis;
So to perform a translation transformation we only need to add some translation factor to each component.
Instead of doing the above, it is better to strategically place the translation factors in a matrix so that when the point is multiplied by the matrix the above operations are performed.
You can find a basic translation matrix easily on the web. Do the multplication by hand and you will see it results in the above equations.
To summarize, the numbers inside the matrix are strategically placed so that when a point is multiplied by the matrix the desired transformation is performed.
ECKILLER
ECKILLER
So what you are saying is that the whole idea of using a matrix is to findout where an object exists in the world?
A matrix is a way to transform objects (translation, rotation, scaling, weird stuff...)
It''s not very difficult to use but it''s quite long to explain it. You should have a look on a book/tutorial about linear algebra (yes, it IS maths ).
It''s not very difficult to use but it''s quite long to explain it. You should have a look on a book/tutorial about linear algebra (yes, it IS maths ).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement