ENTRYPOINT void draw_matrix (ModeInfo *mi) { matrix_configuration *mp = &mps[MI_SCREEN(mi)]; int i; if (!mp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(mp->glx_context)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); if (do_rotate) { glRotatef (mp->view_x, 1, 0, 0); glRotatef (mp->view_y, 0, 1, 0); } #ifdef DEBUG # if 0 glScalef(0.5, 0.5, 0.5); # endif # if 0 glRotatef(-30, 0, 1, 0); # endif draw_grid (mi); #endif mi->polygon_count = 0; /* Render (and tick) each strip, starting at the back (draw the ones farthest from the camera first, to make the alpha transparency work out right.) */ { strip **sorted = malloc (mp->nstrips * sizeof(*sorted)); for (i = 0; i < mp->nstrips; i++) sorted[i] = &mp->strips[i]; qsort (sorted, i, sizeof(*sorted), cmp_strips); for (i = 0; i < mp->nstrips; i++) { strip *s = sorted[i]; tick_strip (mi, s); draw_strip (mi, s); } free (sorted); } auto_track (mi); #if 0 glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f (0,0); glVertex3f(-15,-15,0); glTexCoord2f (0,1); glVertex3f(-15,15,0); glTexCoord2f (1,1); glVertex3f(15,15,0); glTexCoord2f (1,0); glVertex3f(15,-15,0); glEnd(); #endif glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(MI_DISPLAY(mi), MI_WINDOW(mi)); }
ENTRYPOINT void draw_toasters (ModeInfo *mi) { toaster_configuration *bp = &bps[MI_SCREEN(mi)]; Display *dpy = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int i; if (!bp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); glRotatef(current_device_rotation(), 0, 0, 1); glRotatef(bp->view_x, 1, 0, 0); glRotatef(bp->view_y, 0, 1, 0); /* Rotate the scene around a point that's a little deeper in. */ glTranslatef (0, 0, -50); gltrackball_rotate (bp->user_trackball); glTranslatef (0, 0, 50); #if 0 { floater F; F.toaster_p = 0; F.toast_type = 1; F.handle_pos = 0; F.knob_pos = -90; F.loaded = 3; F.x = F.y = F.z = 0; F.dx = F.dy = F.dz = 0; glScalef(2,2,2); if (!MI_IS_WIREFRAME(mi)) glDisable(GL_LIGHTING); if (!MI_IS_WIREFRAME(mi) && do_texture) glDisable(GL_TEXTURE_2D); glBegin(GL_LINES); glVertex3f(-10, 0, 0); glVertex3f(10, 0, 0); glVertex3f(0, -10, 0); glVertex3f(0, 10, 0); glVertex3f(0, 0, -10); glVertex3f(0, 0, 10); glEnd(); if (!MI_IS_WIREFRAME(mi)) glEnable(GL_LIGHTING); if (!MI_IS_WIREFRAME(mi) && do_texture) glEnable(GL_TEXTURE_2D); draw_floater (mi, &F); glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(dpy, window); return; } #endif glScalef (0.5, 0.5, 0.5); draw_origin (mi); glTranslatef (0, 0, -GRID_DEPTH/2.5); draw_grid (mi); mi->polygon_count = 0; for (i = 0; i < bp->nfloaters; i++) { floater *f = &bp->floaters[i]; draw_floater (mi, f); tick_floater (mi, f); } auto_track (mi); glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(dpy, window); }
ENTRYPOINT void draw_matrix (ModeInfo *mi) { matrix_configuration *mp = &mps[MI_SCREEN(mi)]; Display *dpy = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int i; if (!mp->glx_context) return; glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(mp->glx_context)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); glRotatef(current_device_rotation(), 0, 0, 1); if (do_texture) { glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); /* Jeff Epler points out: By using GL_ONE instead of GL_SRC_ONE_MINUS_ALPHA, glyphs are added to each other, so that a bright glyph with a darker one in front is a little brighter than the bright glyph alone. */ glBlendFunc (GL_SRC_ALPHA, GL_ONE); } if (do_rotate) { glRotatef (mp->view_x, 1, 0, 0); glRotatef (mp->view_y, 0, 1, 0); } #ifdef DEBUG # if 0 glScalef(0.5, 0.5, 0.5); # endif # if 0 glRotatef(-30, 0, 1, 0); # endif draw_grid (mi); #endif mi->polygon_count = 0; /* Render (and tick) each strip, starting at the back (draw the ones farthest from the camera first, to make the alpha transparency work out right.) */ { strip **sorted = malloc (mp->nstrips * sizeof(*sorted)); for (i = 0; i < mp->nstrips; i++) sorted[i] = &mp->strips[i]; qsort (sorted, i, sizeof(*sorted), cmp_strips); for (i = 0; i < mp->nstrips; i++) { strip *s = sorted[i]; tick_strip (mi, s); draw_strip (mi, s); } free (sorted); } auto_track (mi); #if 0 glBegin(GL_QUADS); glColor3f(1,1,1); glTexCoord2f (0,0); glVertex3f(-15,-15,0); glTexCoord2f (0,1); glVertex3f(-15,15,0); glTexCoord2f (1,1); glVertex3f(15,15,0); glTexCoord2f (1,0); glVertex3f(15,-15,0); glEnd(); #endif glPopMatrix (); if (mi->fps_p) do_fps (mi); glFinish(); glXSwapBuffers(dpy, window); }