Hi!
I’m once again having problems with my transformations…
How does OpenGL apply a matrix to its vertices?
I need to be able to perform correct transformations, i.e. rotating on local axises. I’ve managed to do this using the glRotatef() and glVertex3d(), but since I need to do my own rotations, I cannot use these calls.
So, here’s how I do it:
tX = X * privateMatrix [0] +
Y * privateMatrix [1] +
Z * privateMatrix [2] +
privateMatrix [12];
tY = X * privateMatrix [4] +
Y * privateMatrix [5] +
Z * privateMatrix [6] +
privateMatrix [13];
tZ = X * privateMatrix [8] +
Y * privateMatrix [9] +
Z * privateMatrix [10] +
privateMatrix [14];
where tX is the transformed coordinate X, and privateMatrix is a matrix that OpenGL calculated. This only rotates on the world axises.
However, I’ve found that if I swap rows and columns in the matrix, I get the desired rotations. Is this correct? Does anyone know of a better way to perform correct transformations?
TIA
Ivan