Retrieving Coordinates after rotations

Hello Guys,

I’m rotating my camera using glRotatef, this work’s fine, but my problem is how can I get the new coordinates.

For example I draw a line, after I make a rotation. If I draw a new line, they’re coordinates is wrong. But if I rotate the camera to the original angle, the line is in correct position.

How can I make this tranformation?

Thank´s for the moment.

Joe Ramone

Hello Joe,
I think you would have got the reply much faster in the beginners section. Anyway…

  1. What does it mean “coordinates are wrong”? Remember you specify object coordinates in the object space, which is rotated by the glRotatef call. If you want your second line not to be rotated, you have to do the inverse transformation after drawing the first line (also in your case you can load the identity matrix).
  2. If you do want to retrieve the new coordinates, you’ll have to do the transformation by yourself. Just get (or compose) the transformation matrix and sequentially multiply it with vertex coordinates of the line.
    Hope this helps.