PDA

View Full Version : OpenGL matrix primer?



NeuroFuzzy
03-06-2011, 01:54 PM
I'm pretty handy with matrix math, and I'm trying to create a hardware accelerated... thingy, called an Iterated Function System. Basically you take a square and copy it and transform it, and repeat that over and over again.

The thing I'm having trouble with is figuring out how to transform everything right, and how to handle OpenGL matrices. The transformation consists of skew, scale, translation, and rotation in two dimensions... but I'm not really sure how to create the matrices (skew matrix especially - I know what's inside of it, just not how to get it into an OpenGL matrix).

So...is there a good tutorial anywhere that explains all the ways to handle OpenGL matrices?

To clarify: If you asked me to I could write the contents of the matrix out by hand. I'm alright with linear transformations... though while programming I get confused where the matrix is being applied.

[edit]
and the final result I would like would be a 2d affine transformation on a square centered at the origin. 4th row and 4th column would just be [0, 0, 0, 1]

Dark Photon
03-06-2011, 07:50 PM
The OpenGL Programming Guide has a good description, IIRC. Here is another:

http://www.songho.ca/opengl/gl_transform.html