X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=hacks%2Fglx%2Fmirrorblob.c;h=eb746d1a101e433d3972a84a5d6326beb54052a4;hb=HEAD;hp=7595e70d243ea6170c6ac1c798e232e14f6bc748;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba;p=xscreensaver diff --git a/hacks/glx/mirrorblob.c b/hacks/glx/mirrorblob.c index 7595e70d..ee9717b0 100644 --- a/hacks/glx/mirrorblob.c +++ b/hacks/glx/mirrorblob.c @@ -44,7 +44,6 @@ "*chooseRandomImages: True \n" \ "*suppressRotationAnimation: True\n" \ -# define refresh_mirrorblob 0 # define release_mirrorblob 0 # include "xlockmore.h" #else /* !STANDALONE */ @@ -66,7 +65,7 @@ #define DEF_TEXTURE "True" #define DEF_OFFSET_TEXTURE "False" #define DEF_PAINT_BACKGROUND "True" -#define DEF_RESOLUTION "30" +#define DEF_RESOLUTION "90" #define DEF_BUMPS "10" #define DEF_MOTION_BLUR "0.0" #define DEF_INCREMENTAL "0" @@ -74,21 +73,10 @@ #define DEF_FADE_TIME "5.0" #define DEF_ZOOM "1.0" -#ifdef HAVE_XMU -# ifndef VMS -# include -#else /* VMS */ -# include -# endif /* VMS */ -#endif - #include "gltrackball.h" #include "grab-ximage.h" -#undef countof -#define countof(x) (sizeof((x)) / sizeof((*x))) - -#define PI 3.1415926535897 +#define PI M_PI /* Options from command line */ static GLfloat blend; @@ -170,7 +158,7 @@ static OptionStruct desc[] = {"-resolution", "Resolution of blob tesselation"}, {"-bumps", "Number of bumps used to disturb blob"}, {"-motion_blur", "Fade blob images (higher number = faster fade)"}, - {"-fade_time", "Number of frames to transistion to next image"}, + {"-fade_time", "Number of frames to transition to next image"}, {"-hold_time", "Number of frames before next image"}, }; @@ -179,7 +167,7 @@ ENTRYPOINT ModeSpecOpt mirrorblob_opts = {countof(opts), opts, countof(vars), va #ifdef USE_MODULES ModStruct mirrorblob_description = {"mirrorblob", "init_mirrorblob", "draw_mirrorblob", NULL, - "draw_mirrorblob", "init_mirrorblob", "handle_event", &mirrorblob_opts, + "draw_mirrorblob", "init_mirrorblob", "free_mirrorblob", &mirrorblob_opts, 1000, 1, 2, 1, 4, 1.0, "", "OpenGL mirrorblob", 0, NULL}; #endif @@ -1730,7 +1718,7 @@ draw_mirrorblob(ModeInfo * mi) if (gp->waiting_for_image_p && gp->first_image_p) return; - glXMakeCurrent(display, window, *(gp->glx_context)); + glXMakeCurrent(display, window, *gp->glx_context); draw_scene(mi); if (mi->fps_p) do_fps (mi); glFinish(); @@ -1786,8 +1774,6 @@ mirrorblob_handle_event (ModeInfo * mi, XEvent * event) return False; } -static void free_mirrorblob(ModeInfo * mi); - /****************************************************************************** * * XMirrorblob initialise entry @@ -1799,7 +1785,7 @@ init_mirrorblob(ModeInfo * mi) mirrorblobstruct *gp; - MI_INIT(mi, Mirrorblob, free_mirrorblob); + MI_INIT(mi, Mirrorblob); gp = &Mirrorblob[screen]; gp->window = MI_WINDOW(mi); @@ -1825,18 +1811,28 @@ init_mirrorblob(ModeInfo * mi) * * XMirrorblob cleanup entry */ -static void +ENTRYPOINT void free_mirrorblob(ModeInfo * mi) { mirrorblobstruct *gp = &Mirrorblob[MI_SCREEN(mi)]; + int i; + + if (!gp->glx_context) return; + glXMakeCurrent (MI_DISPLAY(mi), MI_WINDOW(mi), *gp->glx_context); + if (gp->nodes) free(gp->nodes); if (gp->faces) free(gp->faces); if (gp->bump_data) free(gp->bump_data); if (gp->colours) free(gp->colours); if (gp->tex_coords) free(gp->tex_coords); if (gp->dots) free(gp->dots); + if (gp->normals) free(gp->normals); if (gp->wall_shape) free(gp->wall_shape); if (gp->bump_shape) free(gp->bump_shape); + if (gp->trackball) gltrackball_free (gp->trackball); + + for (i = 0; i < NUM_TEXTURES; i++) + if (gp->textures[i]) glDeleteTextures(1, &gp->textures[i]); } XSCREENSAVER_MODULE ("MirrorBlob", mirrorblob)