X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fpolytopes.c;h=76c1287363a10ba537a13d1ad85d7c57bd152b29;hb=39809ded547bdbb08207d3e514950425215b4410;hp=c99f50d92081e9d5215f535a3d84f0fec23ba8cc;hpb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;p=xscreensaver diff --git a/hacks/glx/polytopes.c b/hacks/glx/polytopes.c index c99f50d9..76c12873 100644 --- a/hacks/glx/polytopes.c +++ b/hacks/glx/polytopes.c @@ -90,9 +90,11 @@ static const char sccsid[] = "@(#)polytopes.c 1.2 05/09/28 xlockmore"; #ifdef STANDALONE # define DEFAULTS "*delay: 25000 \n" \ - "*showFPS: False \n" + "*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 */ @@ -100,7 +102,7 @@ static const char sccsid[] = "@(#)polytopes.c 1.2 05/09/28 xlockmore"; #ifdef USE_GL -#ifndef HAVE_COCOA +#ifndef HAVE_JWXYZ # include #endif #include "gltrackball.h" @@ -108,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}; @@ -2827,6 +2829,7 @@ static void display_polytopes(ModeInfo *mi) { gluPerspective(60.0,pp->aspect,0.1,100.0); } + glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -2860,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; } @@ -2946,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); @@ -3168,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) {