+ENTRYPOINT void
+draw_pipes (ModeInfo * mi)
+{
+ pipesstruct *pp = &pipes[MI_SCREEN(mi)];
+ Display *display = MI_DISPLAY(mi);
+ Window window = MI_WINDOW(mi);
+ Bool wire = MI_IS_WIREFRAME(mi);
+ int i = 0;
+
+ if (!pp->glx_context)
+ return;
+
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(pp->glx_context));
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glColor3f(1.0, 1.0, 1.0);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0);
+ glLightfv(GL_LIGHT0, GL_POSITION, position0);
+ glLightfv(GL_LIGHT1, GL_AMBIENT, ambient1);
+ glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1);
+ glLightfv(GL_LIGHT1, GL_POSITION, position1);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+
+ if (wire)
+ glDisable(GL_LIGHTING);
+ else
+ {
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ /* This looks crappy. */
+ /* glEnable(GL_LIGHT1); */
+ glEnable(GL_DEPTH_TEST);
+ glEnable(GL_NORMALIZE);
+ glEnable(GL_CULL_FACE);
+ }
+
+ glShadeModel(GL_SMOOTH);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
+
+ glPushMatrix();
+
+ pp->initial_rotation += 0.02;
+
+ glTranslatef(0.0, 0.0, fisheye ? -3.8 : -4.8);
+
+ gltrackball_rotate (pp->trackball);
+
+ if (rotatepipes)
+ glRotatef(pp->initial_rotation, 0.0, 1.0, 0.0);
+
+ glScalef(Scale4Window, Scale4Window, Scale4Window);
+
+ mi->polygon_count = 0;
+
+ if (pp->fadeout)
+ {
+ GLfloat s = (pp->fadeout * pp->fadeout) / 10000.0;
+ glScalef (s, s, s);
+ glRotatef (90 * (1 - (pp->fadeout/100.0)), 1, 0, 0.1);
+ pp->fadeout -= 4;
+ if (pp->fadeout <= 0)
+ {
+ pp->fadeout = 0;
+ generate_system (mi);
+ }
+ }
+ else if (pp->system_index < pp->system_size)
+ pp->system_index++;
+ else
+ pp->fadeout = 100;
+
+ for (i = 0; i < pp->system_index; i++)
+ {
+ glCallList (pp->dlists[i]);
+ mi->polygon_count += pp->poly_counts[i];
+ }
+
+ glPopMatrix();