From http://www.jwz.org/xscreensaver/xscreensaver-5.20.tar.gz
[xscreensaver] / hacks / glx / lament.c
index f0526cc5fed3e5a170abdbe0a936a21a9da540b0..97202c1d88875bec1e259a3dd282f80e89a4da90 100644 (file)
@@ -1378,7 +1378,11 @@ static void
 scale_for_window(ModeInfo *mi)
 {
   lament_configuration *lc = &lcs[MI_SCREEN(mi)];
-  int target_size = lc->texture->width * 1.4;
+
+  /* No texture created in -wireframe or -no-texture, so guess. */
+  int target_size = (lc->texture
+                     ? lc->texture->width * 1.4
+                     : 340);
   int win_size = (MI_WIDTH(mi) > MI_HEIGHT(mi) ? MI_HEIGHT(mi) : MI_WIDTH(mi));
 
   /* This scale makes the box take up most of the window */
@@ -1422,7 +1426,10 @@ draw(ModeInfo *mi)
 
   glPushMatrix();
 
+  /* Do it twice because we don't track the device's orientation. */
+  glRotatef( current_device_rotation(), 0, 0, 1);
   gltrackball_rotate (lc->trackball);
+  glRotatef(-current_device_rotation(), 0, 0, 1);
 
   /* Make into the screen be +Y right be +X, and up be +Z. */
   glRotatef(-90.0, 1.0, 0.0, 0.0);