X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fpipes.c;h=9d81200967abf0a7daf049bf97a3b14f805d15da;hb=a445bdd3e3ba4abbee441844b6665b4c3c13d48c;hp=926b7e332e4c769d6584bd559d3e0426479ee670;hpb=df7adbee81405e2849728a24b498ad2117784b1f;p=xscreensaver diff --git a/hacks/glx/pipes.c b/hacks/glx/pipes.c index 926b7e33..9d812009 100644 --- a/hacks/glx/pipes.c +++ b/hacks/glx/pipes.c @@ -54,11 +54,13 @@ static const char sccsid[] = "@(#)pipes.c 4.07 97/11/24 xlockmore"; # define PROGCLASS "Pipes" # define HACK_INIT init_pipes # define HACK_DRAW draw_pipes +# define HACK_RESHAPE reshape_pipes # define pipes_opts xlockmore_opts # define DEFAULTS "*delay: 100 \n" \ "*count: 2 \n" \ "*cycles: 5 \n" \ "*size: 500 \n" \ + "*showFPS: False \n" \ "*fisheye: True \n" \ "*tightturns: False \n" \ "*rotatepipes: True \n" @@ -112,11 +114,7 @@ ModeSpecOpt pipes_opts = #ifdef USE_MODULES ModStruct pipes_description = {"pipes", "init_pipes", "draw_pipes", "release_pipes", -#if defined( MESA ) && defined( SLOW ) "draw_pipes", -#else - "change_pipes", -#endif "change_pipes", NULL, &pipes_opts, 1000, 2, 5, 500, 4, 1.0, "", "Shows a selfbuilding pipe system", 0, NULL}; @@ -144,9 +142,8 @@ ModStruct pipes_description = /*************************************************************************/ typedef struct { -#if defined( MESA ) && defined( SLOW ) int flip; -#endif + GLint WindH, WindW; int Cells[HCELLS][VCELLS][HCELLS]; int usedcolors[DEFINEDCOLORS]; @@ -490,8 +487,8 @@ MakeShape(ModeInfo * mi, int newdir) } } -static void -reshape(ModeInfo * mi, int width, int height) +void +reshape_pipes(ModeInfo * mi, int width, int height) { pipesstruct *pp = &pipes[MI_SCREEN(mi)]; @@ -501,6 +498,8 @@ reshape(ModeInfo * mi, int width, int height) /*glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 15.0); */ gluPerspective(65.0, (GLfloat) width / (GLfloat) height, 0.1, 20.0); glMatrixMode(GL_MODELVIEW); + + glClear(GL_COLOR_BUFFER_BIT); } static void @@ -635,7 +634,7 @@ init_pipes(ModeInfo * mi) pp->window = MI_WINDOW(mi); if ((pp->glx_context = init_GL(mi)) != NULL) { - reshape(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); + reshape_pipes(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); if (rotatepipes) pp->initial_rotation = NRAND(180); /* jwz */ else @@ -695,13 +694,6 @@ draw_pipes(ModeInfo * mi) if (!pp->glx_context) return; - glXMakeCurrent(display, window, *(pp->glx_context)); - -#if defined( MESA ) && defined( SLOW ) - glDrawBuffer(GL_BACK); -#else - glDrawBuffer(GL_FRONT); -#endif glPushMatrix(); glTranslatef(0.0, 0.0, fisheye ? -3.8 : -4.8); @@ -732,9 +724,7 @@ draw_pipes(ModeInfo * mi) glTranslatef((pp->PX - 16) / 3.0 * 4.0, (pp->PY - 12) / 3.0 * 4.0, (pp->PZ - 16) / 3.0 * 4.0); /* Finish the system with another sphere */ mySphere(0.6); -#if defined( MESA ) && defined( SLOW ) - glXSwapBuffers(display, window); -#endif + glPopMatrix(); /* If the maximum number of system was drawn, restart (clearing the screen), */ @@ -970,11 +960,9 @@ draw_pipes(ModeInfo * mi) glFlush(); -#if defined( MESA ) && defined( SLOW ) - pp->flip = !pp->flip; - if (pp->flip) - glXSwapBuffers(display, window); -#endif + glXSwapBuffers(display, window); + + if (mi->fps_p) do_fps (mi); } void