firegun9

03-19-2005, 03:29 PM

Say I have a vertex at (1.0, 1.0, 1.0).

Its coordinates are recorded in variables:

float x=1.0;

float y=1.0;

float z=1.0;

Then I rotate the ModelView Matrix by 45 degree to y axis.

glRotatef(45.0, 0.0, 1.0, 0.0);

glBegin(GL_POINTS);

glVertex3f(x, y, z);

glEnd();

How could I get the information about the transformed coordinates in OpenGL? In this example, I want to get the values of x, y and z after rotate.

Because I want to create some moving cubes which would interact with the ball in a game, I need to know the new positions of the vertices of the cube then recalculate the surfaces for collision detection.

Its coordinates are recorded in variables:

float x=1.0;

float y=1.0;

float z=1.0;

Then I rotate the ModelView Matrix by 45 degree to y axis.

glRotatef(45.0, 0.0, 1.0, 0.0);

glBegin(GL_POINTS);

glVertex3f(x, y, z);

glEnd();

How could I get the information about the transformed coordinates in OpenGL? In this example, I want to get the values of x, y and z after rotate.

Because I want to create some moving cubes which would interact with the ball in a game, I need to know the new positions of the vertices of the cube then recalculate the surfaces for collision detection.