"*count: 25 \n" \
"*cycles: 40 \n" \
"*showFPS: False \n" \
- "*wireframe: False \n"
+ "*wireframe: False \n" \
+ "*suppressRotationAnimation: True\n" \
+# define free_superquadrics 0
+# define release_superquadrics 0
# define superquadrics_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
#ifdef USE_MODULES
ModStruct superquadrics_description =
-{"superquadrics", "init_superquadrics", "draw_superquadrics", "release_superquadrics",
+{"superquadrics", "init_superquadrics", "draw_superquadrics", NULL,
"refresh_superquadrics", "init_superquadrics", NULL, &superquadrics_opts,
1000, 25, 40, 1, 4, 1.0, "",
"Shows 3D mathematical shapes", 0, NULL};
}
static int
-DisplaySuperquadrics(superquadricsstruct * sp)
+DisplaySuperquadrics(ModeInfo *mi)
{
+ superquadricsstruct *sp = &superquadrics[MI_SCREEN(mi)];
int polys = 0;
glDrawBuffer(GL_BACK);
if (sp->wireframe)
SetCull(0, sp);
+ glScalef(0.7, 0.7, 0.7); /* jwz: scale it down a bit */
+
+# 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
+
polys = DoneScale(sp);
glPopMatrix();
}
static int
-NextSuperquadricDisplay(superquadricsstruct * sp)
+NextSuperquadricDisplay(ModeInfo *mi)
{
+ superquadricsstruct *sp = &superquadrics[MI_SCREEN(mi)];
NextSuperquadric(sp);
- return DisplaySuperquadrics(sp);
+ return DisplaySuperquadrics(mi);
}
#define MINSIZE 200
glViewport(0, 0, w, h);
}
#else
- glViewport(0, 0, w, h);
+ int y = 0;
+
+ if (w > h * 5) { /* tiny window: show middle */
+ h = w;
+ y = -h/2;
+ }
+
+ glViewport(0, y, w, h);
#endif
glMatrixMode(GL_PROJECTION);
superquadricsstruct *sp;
- if (superquadrics == NULL) {
- if ((superquadrics = (superquadricsstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (superquadricsstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, superquadrics);
sp = &superquadrics[screen];
sp->mono = (MI_IS_MONO(mi) ? 1 : 0);
MI_COUNT(mi), MI_CYCLES(mi), spinspeed, sp);
ReshapeSuperquadrics(MI_WIDTH(mi), MI_HEIGHT(mi));
- DisplaySuperquadrics(sp);
+ DisplaySuperquadrics(mi);
glFinish();
glXSwapBuffers(display, window);
} else {
glXMakeCurrent(display, window, *(sp->glx_context));
- mi->polygon_count = NextSuperquadricDisplay(sp);
+ mi->polygon_count = NextSuperquadricDisplay(mi);
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}
+#ifndef STANDALONE
ENTRYPOINT void
refresh_superquadrics(ModeInfo * mi)
{
/* Nothing happens here */
}
+#endif
ENTRYPOINT void
reshape_superquadrics(ModeInfo * mi, int width, int height)
ReshapeSuperquadrics(MI_WIDTH(mi), MI_HEIGHT(mi));
}
-ENTRYPOINT void
-release_superquadrics(ModeInfo * mi)
-{
- if (superquadrics != NULL) {
- (void) free((void *) superquadrics);
- superquadrics = NULL;
- }
- FreeAllGL(mi);
-}
-
#endif