- glPushAttrib(GL_ALL_ATTRIB_BITS);
- {
- /* this pair of rotations seem to be necessary to orient the earth correctly */
- glRotatef(90,0,0,1);
- glRotatef(90,0,1,0);
-
- glTranslatef(gp->xpos, gp->ypos, gp->zpos);
- glRotatef(gp->tx, 1, 0, 0);
- glRotatef(gp->ty, 0, 1, 0);
- glRotatef(gp->tz, 0, 0, 1);
- /* draw the sphere */
- draw_sphere(mi);
- }
+
+ get_position (gp->rot, &x, &y, &z, !gp->button_down_p);
+ x = (x - 0.5) * 6;
+ y = (y - 0.5) * 6;
+ z = (z - 0.5) * 3;
+ glTranslatef(x, y, z);
+
+ gltrackball_rotate (gp->trackball);
+
+ if (do_roll)
+ {
+ get_rotation (gp->rot, &x, &y, 0, !gp->button_down_p);
+ glRotatef (x * 360, 1.0, 0.0, 0.0);
+ glRotatef (y * 360, 0.0, 1.0, 0.0);
+ }
+ else
+ glRotatef (current_device_rotation(), 0, 0, 1);
+
+ if (do_stars)
+ {
+ glDisable(GL_TEXTURE_2D);
+ glPushMatrix();
+ glScalef (60, 60, 60);
+ glRotatef (90, 1, 0, 0);
+ glRotatef (35, 1, 0, 0);
+ glCallList (gp->starlist);
+ mi->polygon_count += gp->starcount;
+ glPopMatrix();
+ glClear(GL_DEPTH_BUFFER_BIT);
+ }
+
+ glRotatef (90, 1, 0, 0);
+ glRotatef (35, 1, 0, 0);
+ glRotatef (10, 0, 1, 0);
+ glRotatef (120, 0, 0, 1);
+
+ glScalef (3, 3, 3);
+
+# ifdef HAVE_MOBILE
+ glScalef (2, 2, 2);
+# endif
+
+ if (wire)
+ glColor3f (0.5, 0.5, 1);
+ else
+ glColor3f (1, 1, 1);
+
+ if (do_texture)
+ {
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture (GL_TEXTURE_2D, gp->tex1);
+ }
+
+ glPushMatrix();
+ glRotatef (gp->z * 360, 0, 0, 1);
+ glCallList (gp->platelist);
+ mi->polygon_count += resolution*resolution;