Hello, I am very newbie with openGL.
I have a simple code, but I cant get the movements.
Situation: a triangle, a quad. Both rotatin their own axis (so I translate them to the origin).
Then I need them both rotating around a point (0,0,-6). But I can’t achieve this second rotations. What’s wrong?
void drawRotations(void)
{
glTranslatef(-1.5,0,-6);
glPushMatrix();
glTranslatef(0,-1/3.f,0); //
glRotatef(alfa,0,1,0);
glTranslatef(0,1/3.f,0);
glBegin(GL_TRIANGLES);
glColor3f(1.0,0.0,0.0); //red
glVertex3f(0,1,0);
glColor3f(0.0,1.0,0.0); // green
glVertex3f(-1,-1,0);
glColor3f(0.0,0.0,1.0); // blue
glVertex3f(1,-1,0);
glEnd();
glPopMatrix();
glTranslatef(3.f, 0,0);
glPushMatrix();
glRotatef(alfa,0,1,0);
glBegin(GL_QUADS);
glColor3f(0.0,1.0,1.0);
glVertex3f(-1,1,0);
glVertex3f(1,1,0);
glVertex3f(1,-1,0);
glVertex3f(-1,-1,0);
glEnd();
glPopMatrix();
//glRotatef(alfa,0,1,0); here I want them to rotate around
//glTranslatef(0,0,-6); this point. No effect at all
}
the loop, the evironment is well set.
Any idea, thanks for any suggestion.
kovi