+
+
+ gp->gear_outer = glGenLists(1);
+ glNewList(gp->gear_outer, GL_COMPILE);
+ if (wire) {
+ if (mono)
+ glColor4fv(white);
+ else
+ glColor4fv(blue);
+ } else {
+ if (mono)
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray);
+ else
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
+ }
+ gear(5.7, 7.0, 2.0, 36, 0.7, wire, True);
+
+ /* put some nubs on the outer ring, so we can tell how it's moving */
+ glPushMatrix();
+ glTranslatef(7.0, 0, 0);
+ glRotatef(90, 0, 1, 0);
+ tube(0.5, 0.5, 10, wire); /* nub 1 */
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(120, 0, 0, 1);
+ glTranslatef(7.0, 0, 0);
+ glRotatef(90, 0, 1, 0);
+ tube(0.5, 0.5, 10, wire); /* nub 2 */
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(240, 0, 0, 1);
+ glTranslatef(7.0, 0, 0);
+ glRotatef(90, 0, 1, 0);
+ tube(0.5, 0.5, 10, wire); /* nub 3 */
+ glPopMatrix();
+
+
+ glEndList();
+ if (!wire)
+ glEnable(GL_NORMALIZE);
+
+ gp->armature = glGenLists(1);
+ glNewList(gp->armature, GL_COMPILE);
+ if (wire) {
+ if (mono)
+ glColor4fv(white);
+ else
+ glColor4fv(blue);
+ } else {
+ if (mono)
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray);
+ else
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray);
+ }
+
+ glTranslatef(0, 0, 1.5);
+
+ tube(0.5, 10, 15, wire); /* center axle */
+
+ glPushMatrix();
+ glTranslatef(0.0, 4.2, -1);
+ tube(0.5, 3, 15, wire); /* axle 1 */
+ glTranslatef(0, 0, 1.8);
+ tube(0.7, 0.7, 15, wire);
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(120, 0.0, 0.0, 1.0);
+ glTranslatef(0.0, 4.2, -1);
+ tube(0.5, 3, 15, wire); /* axle 2 */
+ glTranslatef(0, 0, 1.8);
+ tube(0.7, 0.7, 15, wire);
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(240, 0.0, 0.0, 1.0);
+ glTranslatef(0.0, 4.2, -1);
+ tube(0.5, 3, 15, wire); /* axle 3 */
+ glTranslatef(0, 0, 1.8);
+ tube(0.7, 0.7, 15, wire);
+ glPopMatrix();
+
+ glTranslatef(0, 0, 1.5); /* center disk */
+ tube(1.5, 2, 20, wire);
+
+ glPushMatrix();
+ glRotatef(270, 0, 0, 1);
+ glRotatef(-10, 0, 1, 0);
+ glTranslatef(-2.2, 0, 0);
+ arm(4.0, 1.0, 0.5, 2.0, 1.0, wire); /* arm 1 */
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(30, 0, 0, 1);
+ glRotatef(-10, 0, 1, 0);
+ glTranslatef(-2.2, 0, 0);
+ arm(4.0, 1.0, 0.5, 2.0, 1.0, wire); /* arm 2 */
+ glPopMatrix();
+
+ glPushMatrix();
+ glRotatef(150, 0, 0, 1);
+ glRotatef(-10, 0, 1, 0);
+ glTranslatef(-2.2, 0, 0);
+ arm(4.0, 1.0, 0.5, 2.0, 1.0, wire); /* arm 3 */
+ glPopMatrix();
+
+ glEndList();
+ if (!wire)
+ glEnable(GL_NORMALIZE);
+ }