mathx

10-15-2001, 03:52 AM

Hello,

Ok, I have a triangle, and I want to rotate it around its "tail" (the oposite of the base). I get that glRotate rotates the triangle around the origin, in the vector I give it. So I figured, I have to translate the triangle, rotate it, then translate back, but it doesn't work, because the origin is also translated. If I build the triangle, so that is points to the origin, and then translate it works, but that's not an option... Here is the code...

glRotatef(ang1, 0, 1, 0);

glColor3b(127, 0, 0);

glBegin(GL_TRIANGLES);

glVertex3f(3, 0, 0);

glVertex3f(4, -1, 0);

glVertex3f(4, 1, 0);

glEnd;

Any tips? http://www.opengl.org/discussion_boards/ubb/smile.gif

thanks,

Matheus.

Ok, I have a triangle, and I want to rotate it around its "tail" (the oposite of the base). I get that glRotate rotates the triangle around the origin, in the vector I give it. So I figured, I have to translate the triangle, rotate it, then translate back, but it doesn't work, because the origin is also translated. If I build the triangle, so that is points to the origin, and then translate it works, but that's not an option... Here is the code...

glRotatef(ang1, 0, 1, 0);

glColor3b(127, 0, 0);

glBegin(GL_TRIANGLES);

glVertex3f(3, 0, 0);

glVertex3f(4, -1, 0);

glVertex3f(4, 1, 0);

glEnd;

Any tips? http://www.opengl.org/discussion_boards/ubb/smile.gif

thanks,

Matheus.