X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fpolytopes.c;h=76c1287363a10ba537a13d1ad85d7c57bd152b29;hb=39809ded547bdbb08207d3e514950425215b4410;hp=4f401d50a3b9b9b14f45f3fe0976b67a00a0d343;hpb=aa75c7476aeaa84cf3abc192b376a8b03c325213;p=xscreensaver diff --git a/hacks/glx/polytopes.c b/hacks/glx/polytopes.c index 4f401d50..76c12873 100644 --- a/hacks/glx/polytopes.c +++ b/hacks/glx/polytopes.c @@ -93,7 +93,8 @@ static const char sccsid[] = "@(#)polytopes.c 1.2 05/09/28 xlockmore"; "*showFPS: False \n" \ "*suppressRotationAnimation: True\n" \ -# define refresh_polytopes 0 +# define free_polytopes 0 +# define release_polytopes 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -109,7 +110,7 @@ static const char sccsid[] = "@(#)polytopes.c 1.2 05/09/28 xlockmore"; #ifdef USE_MODULES ModStruct polytopes_description = -{"polytopes", "init_polytopes", "draw_polytopes", "release_polytopes", +{"polytopes", "init_polytopes", "draw_polytopes", NULL, "draw_polytopes", "change_polytopes", NULL, &polytopes_opts, 25000, 1, 1, 1, 1.0, 4, "", "Shows one of the six regular 4d polytopes rotating in 4d", 0, NULL}; @@ -2862,10 +2863,16 @@ static void display_polytopes(ModeInfo *mi) ENTRYPOINT void reshape_polytopes(ModeInfo *mi, int width, int height) { polytopesstruct *pp = &poly[MI_SCREEN(mi)]; + int y = 0; + + if (width > height * 5) { /* tiny window: show middle */ + height = width; + y = -height/2; + } pp->WindW = (GLint)width; pp->WindH = (GLint)height; - glViewport(0,0,width,height); + glViewport(0,y,width,height); pp->aspect = (GLfloat)width/(GLfloat)height; } @@ -2948,13 +2955,7 @@ ENTRYPOINT void init_polytopes(ModeInfo *mi) { polytopesstruct *pp; - if (poly == NULL) - { - poly = (polytopesstruct *)calloc(MI_NUM_SCREENS(mi), - sizeof(polytopesstruct)); - if (poly == NULL) - return; - } + MI_INIT(mi, poly); pp = &poly[MI_SCREEN(mi)]; pp->trackballs[0] = gltrackball_init(True); @@ -3170,33 +3171,6 @@ ENTRYPOINT void draw_polytopes(ModeInfo *mi) } -/* - *----------------------------------------------------------------------------- - * The display is being taken away from us. Free up malloc'ed - * memory and X resources that we've alloc'ed. Only called - * once, we must zap everything for every screen. - *----------------------------------------------------------------------------- - */ - -ENTRYPOINT void release_polytopes(ModeInfo *mi) -{ - if (poly != NULL) - { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) - { - polytopesstruct *hp = &poly[screen]; - - if (hp->glx_context) - hp->glx_context = (GLXContext *)NULL; - } - (void) free((void *)poly); - poly = (polytopesstruct *)NULL; - } - FreeAllGL(mi); -} - #ifndef STANDALONE ENTRYPOINT void change_polytopes(ModeInfo *mi) {