Hi all,
I’m in trouble with a transformation. I have to transform a vertex with the actual matrix. Here ist the codefragment:
[b]
GLdouble mat[16];
glPushMatrix();
…
glTranslated(dx, dy, dz);
…
glGetDoublev(GL_MODELVIEW_MATRIX, mat);
[/b]
at this point I should have the matrix use by OpenGl to transform vertizees according to the actual translate, rotate and stretch values saved in the array mat.
glBegin(GL_QUADS);
glVertex3d(v0.x, v0.y, v0.z);
…
glEnd();
the following calculation should have the same result vor v0
xEye = mat[0]*v0.x + mat[4]*v0.y + mat[8]*v0.z + mat[12];
yEye = mat[1]*v0.x + mat[5]*v0.y + mat[9]*v0.z + mat[13];
zEye = mat[2]*v0.x + mat[6]*v0.y + mat[10]*v0.z + mat[14];
Is this correct?
Is there a better way to do this calculation, probably any openGl function?
Thank you all for your help!