From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver] / hacks / glx / engine.c
index c058bc50f415549b9b2d5a20b6c1337207057055..bd0803130d70269f8ead02df2b6b7af5227abaac 100644 (file)
@@ -109,8 +109,12 @@ typedef struct {
   rotator *rot;
   trackball_state *trackball;
   Bool button_down_p;
+# ifdef HAVE_GLBITMAP
   XFontStruct *xfont;
   GLuint font_dlist;
+# else
+  texture_font_data *font_data;
+# endif
   char *engine_name;
   int engineType;
   int movepaused;
@@ -614,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);
@@ -623,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);
@@ -895,7 +906,6 @@ ENTRYPOINT void init_engine(ModeInfo *mi)
  } else {
      MI_CLEARWINDOW(mi);
  }
- glClearColor(0.0,0.0,0.0,0.0);
  glShadeModel(GL_SMOOTH);
  glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
  glEnable(GL_DEPTH_TEST);
@@ -917,7 +927,12 @@ ENTRYPOINT void init_engine(ModeInfo *mi)
 
  e->shaft_polys = makeshaft(e);
  e->piston_polys = makepiston(e);
+
+#ifdef HAVE_GLBITMAP
  load_font (mi->dpy, "titleFont", &e->xfont, &e->font_dlist);
+#else
+ e->font_data = load_texture_font (mi->dpy, "Font");
+#endif
 }
 
 ENTRYPOINT Bool
@@ -975,8 +990,14 @@ ENTRYPOINT void draw_engine(ModeInfo *mi)
 
   mi->polygon_count = display(e);
 
+  glColor3f (1, 1, 0);
   if (do_titles)
-      print_gl_string (mi->dpy, e->xfont, e->font_dlist,
+      print_gl_string (mi->dpy, 
+# ifdef HAVE_GLBITMAP
+                       e->xfont, e->font_dlist,
+# else
+                       e->font_data,
+# endif
                        mi->xgwa.width, mi->xgwa.height,
                        10, mi->xgwa.height - 10,
                        e->engine_name, False);