Reputation: 327
i rotate my object, that is a triangle . But my object's center moves.
//background draw
DrawScreen();
glPushMatrix();
glTranslatef(xgotur,ygotur,zgotur);
glRotatef(derece,0.0,0.0,1.0);
// drawing my object
glBegin(GL_POLYGON);
glColor3d(0.2, 0.5, 0.7);
glVertex2f(-0.1+aralik_bosluk, 0.0+aralik_bosluk);
glVertex2f(0.0+aralik_bosluk,0.4+aralik_bosluk);
glVertex2f(0.1+aralik_bosluk, 0.0+aralik_bosluk);
glEnd();
// finish draw
glPopMatrix();
Upvotes: 1
Views: 531
Reputation: 28114
When you rotate an object with glRotate()
, it will rotate around the World Origin and not the origin of your object.
You should check a good example here about how to rotate your object around a Local Origin :
Rotation Local Origin
Upvotes: 6