X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=hacks%2Fglx%2Fhypertorus.c;h=7e1cc3e7651839b2fbefb45f6ae3ce64ee57257d;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hp=908f612e266a8002114d52aeb95ee4420acf7ff7;hpb=b81f521c5ad7022ac12db18ca8fcdd9fb063831e;p=xscreensaver diff --git a/hacks/glx/hypertorus.c b/hacks/glx/hypertorus.c index 908f612e..7e1cc3e7 100644 --- a/hacks/glx/hypertorus.c +++ b/hacks/glx/hypertorus.c @@ -87,24 +87,23 @@ static const char sccsid[] = "@(#)hypertorus.c 1.2 05/09/28 xlockmore"; #ifdef STANDALONE # define DEFAULTS "*delay: 25000 \n" \ "*showFPS: False \n" \ + "*suppressRotationAnimation: True\n" \ # define refresh_hypertorus 0 +# define release_hypertorus 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ #endif /* !STANDALONE */ #ifdef USE_GL -#ifndef HAVE_COCOA -# include -#endif #include "gltrackball.h" #ifdef USE_MODULES ModStruct hypertorus_description = -{"hypertorus", "init_hypertorus", "draw_hypertorus", "release_hypertorus", +{"hypertorus", "init_hypertorus", "draw_hypertorus", NULL, "draw_hypertorus", "change_hypertorus", NULL, &hypertorus_opts, 25000, 1, 1, 1, 1.0, 4, "", "Shows a hypertorus rotating in 4d", 0, NULL}; @@ -505,6 +504,17 @@ static int hypertorus(ModeInfo *mi, double umin, double umax, double vmin, } } +#if 0 /* #### not working */ +# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */ + { + GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi); + int o = (int) current_device_rotation(); + if (o != 0 && o != 180 && o != -180) + glScalef (1/h, 1/h, 1/h); + } +# endif +#endif + skew = num_spirals; ur = umax-umin; vr = vmax-vmin; @@ -820,18 +830,12 @@ ENTRYPOINT void init_hypertorus(ModeInfo *mi) { hypertorusstruct *hp; - if (hyper == NULL) - { - hyper = (hypertorusstruct *)calloc(MI_NUM_SCREENS(mi), - sizeof(hypertorusstruct)); - if (hyper == NULL) - return; - } + MI_INIT(mi, hyper, NULL); hp = &hyper[MI_SCREEN(mi)]; - hp->trackballs[0] = gltrackball_init(); - hp->trackballs[1] = gltrackball_init(); + hp->trackballs[0] = gltrackball_init(True); + hp->trackballs[1] = gltrackball_init(True); hp->current_trackball = 0; hp->button_pressed = False; @@ -986,33 +990,6 @@ ENTRYPOINT void draw_hypertorus(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_hypertorus(ModeInfo *mi) -{ - if (hyper != NULL) - { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) - { - hypertorusstruct *hp = &hyper[screen]; - - if (hp->glx_context) - hp->glx_context = (GLXContext *)NULL; - } - (void) free((void *)hyper); - hyper = (hypertorusstruct *)NULL; - } - FreeAllGL(mi); -} - #ifndef STANDALONE ENTRYPOINT void change_hypertorus(ModeInfo *mi) {