From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver] / hacks / glx / engine.c
index d83c0e45a6a55437c257461330c4d073e73e6425..bd0803130d70269f8ead02df2b6b7af5227abaac 100644 (file)
@@ -618,6 +618,7 @@ static int display(Engine *e)
             e->lookat[0], e->lookat[1], e->lookat[2], 
             0.0, 1.0, 0.0);
   glPushMatrix();
+
   glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
   glLightfv(GL_LIGHT0, GL_SPECULAR, light_sp);
   glLightfv(GL_LIGHT0, GL_DIFFUSE, light_sp);
@@ -627,9 +628,15 @@ static int display(Engine *e)
     get_position (e->rot, &x, &y, &z, !e->button_down_p);
     glTranslatef(x*16-9, y*14-7, z*16-10);
   }
+
   if (spin) {
     double x, y, z;
+
+    /* Do it twice because we don't track the device's orientation. */
+    glRotatef( current_device_rotation(), 0, 0, 1);
     gltrackball_rotate (e->trackball);
+    glRotatef(-current_device_rotation(), 0, 0, 1);
+
     get_rotation(e->rot, &x, &y, &z, !e->button_down_p);
     glRotatef(x*ONEREV, 1.0, 0.0, 0.0);
     glRotatef(y*ONEREV, 0.0, 1.0, 0.0);
@@ -983,6 +990,7 @@ ENTRYPOINT void draw_engine(ModeInfo *mi)
 
   mi->polygon_count = display(e);
 
+  glColor3f (1, 1, 0);
   if (do_titles)
       print_gl_string (mi->dpy, 
 # ifdef HAVE_GLBITMAP