ResearchI49a
08-25-2004, 10:42 PM
I am simulating a ball rotate along an axis which is the tangent line of the ball to a box.
Here is the display code. The ball only rotates along its own axis. Please indicate how to modify. Thanks a lot.
glPushMatrix();
glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0);
glPushMatrix();
glScalef (2.0, 1.5, 1.3);
glutWireCube (1.2);
glPopMatrix();
glTranslatef (0.0, 1.5, 0.0);
glRotatef ((GLfloat) head, 0.0, 0.0, 1.0);
glutWireSphere(0.7, 10, 10);
glPopMatrix();
glutSwapBuffers();
Here is the display code. The ball only rotates along its own axis. Please indicate how to modify. Thanks a lot.
glPushMatrix();
glRotatef ((GLfloat) shoulder, 0.0, 0.0, 1.0);
glPushMatrix();
glScalef (2.0, 1.5, 1.3);
glutWireCube (1.2);
glPopMatrix();
glTranslatef (0.0, 1.5, 0.0);
glRotatef ((GLfloat) head, 0.0, 0.0, 1.0);
glutWireSphere(0.7, 10, 10);
glPopMatrix();
glutSwapBuffers();