# define superquadrics_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
# define superquadrics_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
-{"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};
"refresh_superquadrics", "init_superquadrics", NULL, &superquadrics_opts,
1000, 25, 40, 1, 4, 1.0, "",
"Shows 3D mathematical shapes", 0, NULL};
DoneScale(superquadricsstruct * sp)
{
double xx, yy, zz, xp = 0, yp = 0, zp = 0, xn, yn, zn, xnp = 0,
ynp = 0, znp = 0;
int ih, iv;
DoneScale(superquadricsstruct * sp)
{
double xx, yy, zz, xp = 0, yp = 0, zp = 0, xn, yn, zn, xnp = 0,
ynp = 0, znp = 0;
int ih, iv;
}
/* PURIFY 4.0.1 reports an unitialized memory read on the next line when using
* MesaGL 2.2 and -mono. This has been fixed in MesaGL 2.3 and later. */
}
/* PURIFY 4.0.1 reports an unitialized memory read on the next line when using
* MesaGL 2.2 and -mono. This has been fixed in MesaGL 2.3 and later. */
if (!sp->flatshade)
glNormal3f(sp->Prevxn[iv - 1], sp->Prevyn[iv - 1], sp->Prevzn[iv - 1]);
glVertex3f(sp->Prevxx[iv - 1], sp->Prevyy[iv - 1], sp->Prevzz[iv - 1]);
if (!sp->flatshade)
glNormal3f(sp->Prevxn[iv - 1], sp->Prevyn[iv - 1], sp->Prevzn[iv - 1]);
glVertex3f(sp->Prevxx[iv - 1], sp->Prevyy[iv - 1], sp->Prevzz[iv - 1]);
+ 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);
- 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);
- if (superquadrics == NULL) {
- if ((superquadrics = (superquadricsstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (superquadricsstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, superquadrics);
MI_COUNT(mi), MI_CYCLES(mi), spinspeed, sp);
ReshapeSuperquadrics(MI_WIDTH(mi), MI_HEIGHT(mi));
MI_COUNT(mi), MI_CYCLES(mi), spinspeed, sp);
ReshapeSuperquadrics(MI_WIDTH(mi), MI_HEIGHT(mi));
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}
if (mi->fps_p) do_fps (mi);
glFinish();
glXSwapBuffers(display, window);
}