AngryHippo
12-02-2010, 02:37 AM
Hi. I am simply trying to rotate a triangle using rotatef but whenever I use it it not only rotates but travels around the screen. I have read multiple threads here about rotatef but they don't seem to fix my problem. Here is my code:
glPushMatrix();
glRotatef(100,0,0,1);
glTranslatef(400,200, 0);
glBegin(GL_TRIANGLES);
glVertex2i(-40, -40);
glVertex2i( 40, -40);
glVertex2i(-40, 40);
glEnd();
glPopMatrix();
I have seen people give reasonable explanations about how it is rotating around the origin and I need to translate to a new origin but I am pretty sure I am using glTranslate correctly? Is rotatef only to be used for 3d?
glPushMatrix();
glRotatef(100,0,0,1);
glTranslatef(400,200, 0);
glBegin(GL_TRIANGLES);
glVertex2i(-40, -40);
glVertex2i( 40, -40);
glVertex2i(-40, 40);
glEnd();
glPopMatrix();
I have seen people give reasonable explanations about how it is rotating around the origin and I need to translate to a new origin but I am pretty sure I am using glTranslate correctly? Is rotatef only to be used for 3d?