# glRotatef() transformation

This topic is 2896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,
AS shown in figure if

int x1= 100.0, y1= 100.0, x2= 100, y2= 200.0

glTranslatef(100.0, 100.0, 0.0)
glRotatef(30.0f,0.0, 0.0, 1.0)

glBegin(GL_LINES)
glVertex2f(x1, y1);
glVertex2f(x2 , y2);
glEnd();

Then as we can see the RED LINE is the actual line and according to the co-ordinate system ie BLACK LINES the position of the point 'A' in figure is (100,100)

But when it is translated then the co-ordinate is shifted to (100,100) as shown by GREEN LINES and then rotated so what will be the position of point 'A' , How to calculate it????

All suggestions are welcome

##### Share on other sites
No idea what you are asking. You took a point 100,100
Then rotated it 30 degrees to make it something like 75,125
Then translated it by 100,100
= 175, 225

##### Share on other sites

No idea what you are asking. You took a point 100,100
Then rotated it 30 degrees to make it something like 75,125
Then translated it by 100,100
= 175, 225

I just want to know how to find the position of a point before and after rotation.

##### Share on other sites
The function definitions have the transformation matrices.

http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml
http://www.opengl.org/sdk/docs/man/xhtml/glTranslate.xml

##### Share on other sites
glGetDoublev(GL_MODELVIEW_MATRIX) look up glGetDouble, call that function after your glRotate/translate functions, they will give you a 4x4 matrix. Multiply your point x,y,z by the 4x4 matrix.You have to perform the math your graphics card does.

..

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 13
• 30
• 9
• 16
• 12