Hi,
in my scene there is only one model. I would like to project a point onto this model - this works as long as I don’t move or rotate the model. How do I get the right matrix?? Because my point after rotating is always outside of the model and not anywhere where it is supposed to be.
What I do now is like that:
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslated(GLTranslateX, 0.0, 0.0);
glTranslated(0.0, GLTranslateY, 0.0);
glTranslated(0.0, 0.0, GLTranslateZ );
glGetDoublev( GL_MODELVIEW_MATRIX, dmodel );
glPushMatrix();
glRotated(GLRotateX,1.0,0.0,0.0);
glRotated(GLRotateY,0.0,1.0,0.0);
// drawing here
glMultMatrixd(dmodel);
glGetDoublev( GL_MODELVIEW_MATRIX, dmodel );
glPopMatrix();//Transform
glPopMatrix();//Rotate
I tried several placements of glGetDoublev and glMultMatrixd but none of them gave me the right result.
I thought this is the way to go, since after each glPopMatrix I go one transformation back in the stack.
Hope somebody can help me out with this misery!
Martin