Hi there,

Suppose that I want to rotate an object about the point say (525,300) ,90 degrees.Ho wthis can be implemented in openGL.I learned that I should transate the object to the origin (0,0),rotate,and then translate bac to my chosen point.However.I couldn’t apply this correctly.Can any one indicate to me the steps with code.

Thanks in advance

For your example, you would do something like so…

// You only gave 2 coords, I’ll assume x,y

// This translate sets things back where they were

glTranslatef(525, 300, 0);

// You didn’t specify what vector to rotate around, so I’ll assume a Z vector

glRotate(90, 0.0, 0.0, 1.0);

// This one moves 525, 300 to the origin

glTranslatef(-525, -300, 0)

You just have to remember that because the matrices in OpenGL are post multiplied, you have to think about things as though the last transformation you did is the first one applied. (Or you can think about it as the first one modifies the coordinate system, not the world. That is more confusing, IMO, though.)

Thanks a lot…