How to rotate the object itself? And when i scale the object the position of the object also moved; I want to place the object at same positio.
glRotate… is used to rotate.
An object is scaled around the origin so if you for example center a cube around the origin and then scale it, it will not move.
It is important to do scaling/rotation/translation in correct order.
Mikael
[This message has been edited by mikael_aronsson (edited 11-03-2003).]
Can you give the code, Please.
Here i have placed my code. I tried to rotate the object around itself. But it won’t work. Please modify the code.
glLoadIdentity();
glRotatef(gfAngle, 0.0f, 0.0f, 10.0f);
glBegin(GL_LINE_LOOP);
glVertex3f(10.0f, 10.0f, 0.0f);
glVertex3f(60.0f, 10.0f, 0.0f);
glVertex3f(60.0f, 60.0f, 0.0f);
glVertex3f(10.0f, 60.0f, 0.0f);
glVertex3f(10.0f, 10.0f, 0.0f);
glEnd();
glLoadIdentity();
glFinish();
[This message has been edited by Balu (edited 11-03-2003).]
Ok, if my calculations are right, the center of that line loop is about 35,35.
So… do this:
glTranslatef(35, 35, 0); // translate back to position
glRotatef(gfAngle, 0.0f, 0.0f, 1.0f);
glTranslatef(-35, -35, 0); // translate to origin
Thank you, it is very helpful for me.