From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver] / hacks / glx / rubikblocks.c
index 12282771d750338cbbb21df91cd88eb4693ca333..86968ad97d52731291e93831c204e12742df9e85 100644 (file)
@@ -262,7 +262,12 @@ draw_main(ModeInfo *mi, rubikblocks_conf *cp)
   glLoadIdentity();
   get_position(cp->rot, &x, &y, &z, !cp->button_down);
   glTranslatef((x-0.5)*6, (y-0.5)*6, -20);
+
+  /* Do it twice because we don't track the device's orientation. */
+  glRotatef( current_device_rotation(), 0, 0, 1);
   gltrackball_rotate(cp->trackball);
+  glRotatef(-current_device_rotation(), 0, 0, 1);
+
   get_rotation(cp->rot, &x, &y, &z, !cp->button_down);
   glRotatef(x*360, 1, 0, 0);
   glRotatef(y*360, 0, 1, 0);
@@ -439,7 +444,6 @@ init_gl(ModeInfo *mi)
   }
 
   glClearDepth(1.0);
-  glClearColor(0.0, 0.0, 0.0, 1.0);
   glDrawBuffer(GL_BACK);
   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   glShadeModel(GL_FLAT);
@@ -462,7 +466,7 @@ init_gl(ModeInfo *mi)
   glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, material_diffuse);
   glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, material_specular);
   glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
-  if(!tex) return;
+  if (!tex) return;
   glEnable(GL_TEXTURE_2D);
 #ifdef MIPMAP
   clear_gl_error();