Is there a way you can get the position of an object in the 3d world? I read I had to multiply my vertices position (what vertices? Isn't that what i'开发者_JS百科m looking for?) and the GL_MODELVIEW. How am I supose to do this? Can someone post some code?
For example I have:
glpushmatrix();
glrotatef(something, 1.0, 0.0, .0);
glrotatef(anotherting, .0, 1.0, .0);
glRotatef(more, .0, 1.0, .0);
glTranslatef(.0, .0, 100);
PaintObect();
glPopMatrix();
Is it possible to know the 3d world absolut coordinates?
Thanks guys.
Nevermind i just found out.
GLfloat matrix[16];
glGetFloatv (GL_MODELVIEW_MATRIX, matrix);
const float position_x = matrix[12];
const float position_y = matrix[13];
const float position_z = matrix[14];
精彩评论