From http://www.jwz.org/xscreensaver/xscreensaver-5.35.tar.gz
[xscreensaver] / hacks / glx / blinkbox.c
index de7d55e741b262ab40b0d2a2791bff964512f659..ba4693815f6d474d64d0eb54881267fae92eb4ac 100644 (file)
@@ -14,6 +14,7 @@
 
 #define DEFAULTS       "*delay:        30000            \n" \
                        "*wireframe:    False            \n" \
+                       "*suppressRotationAnimation: True\n" \
 
 # define refresh_ball 0
 # define release_ball 0
@@ -151,7 +152,7 @@ swap_mov(GLfloat *a, GLfloat *b)
   swap(a,b);
   j = get_rand();
   if (*a < 0)
-    *a = (j *= -1);
+    *a = j * -1;
   else
     *a = j;
 }
@@ -243,6 +244,13 @@ reshape_ball (ModeInfo *mi, int width, int height)
              0.0, 0.0, 0.0,
              0.0, 2.0,  10.0);
 
+# ifdef HAVE_MOBILE    /* Keep it the same relative size when rotated. */
+  {
+    int o = (int) current_device_rotation();
+    if (o != 0 && o != 180 && o != -180)
+      glScalef (1/h, 1/h, 1/h);
+  }
+# endif
 }
 
 static void
@@ -386,8 +394,6 @@ init_ball (ModeInfo *mi)
     bp->des_amt = bp->bscale.wh / MAX_COUNT;
   }
 
-  bp->glx_context = init_GL(mi);
-
   reshape_ball(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
   bp->ballList = glGenLists(1);
   glNewList(bp->ballList, GL_COMPILE);
@@ -403,7 +409,6 @@ init_ball (ModeInfo *mi)
 
   glEnable(GL_COLOR_MATERIAL);
   glShadeModel(GL_SMOOTH);
-  glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
   glClearDepth(1.0f);
   glEnable(GL_DEPTH_TEST);
   glDepthFunc(GL_LEQUAL);