+ glEndList ();
+}
+
+
+/* Window management, etc
+ */
+ENTRYPOINT void
+reshape_sws (ModeInfo *mi, int width, int height)
+{
+ sws_configuration *sc = &scs[MI_SCREEN(mi)];
+
+ /* Set up matrices for perspective text display
+ */
+ {
+ GLfloat desired_aspect = (GLfloat) 3/4;
+ int w = mi->xgwa.width;
+ int h = mi->xgwa.height;
+ int yoff = 0;
+ GLfloat rot = current_device_rotation();
+
+#ifdef KEEP_ASPECT
+ {
+ int h2 = w * desired_aspect;
+ yoff = (h - h2) / 2; /* Wide window: letterbox at top and bottom. */
+ if (yoff < 0) yoff = 0; /* Tall window: clip off the top. */
+ h = h2;
+ }
+#endif
+
+ glMatrixMode (GL_PROJECTION);
+ glViewport (0, yoff, w, h);
+
+ glMatrixMode (GL_MODELVIEW);
+ glLoadIdentity ();
+ gluPerspective (80.0, 1/desired_aspect, 1000, 55000);
+ gluLookAt (0.0, 0.0, 4600.0,
+ 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0);
+
+ glRotatef(rot, 0, 0, 1);
+
+ /* Horrible kludge to prevent the text from materializing already
+ on screen on iPhone in landscape mode.
+ */
+ if ((rot > 45 && rot < 135) ||
+ (rot < -45 && rot > -135))
+ {
+ GLfloat s = 1.1;
+ glScalef (s, s, s);
+ }
+
+ glRotatef (-60.0, 1.0, 0.0, 0.0);
+
+#if 0
+ glRotatef (60.0, 1.0, 0.0, 0.0);
+ glTranslatef (260, 3200, 0);
+ glScalef (1.85, 1.85, 1);
+#endif
+
+ /* The above gives us an arena where the bottom edge of the screen is
+ represented by the line (-2100,-3140,0) - ( 2100,-3140,0). */
+
+ /* Now let's move the origin to the front of the screen. */
+ glTranslatef (0.0, -3140, 0.0);
+
+ /* And then let's scale so that the bottom of the screen is 1.0 wide. */
+ glScalef (4200, 4200, 4200);
+ }
+
+
+ /* Compute the height in pixels of the line at the bottom of the screen. */
+ {
+ GLdouble mm[17], pm[17];
+ GLint vp[5];
+ GLdouble x = 0.5, y1 = 0, z = 0;
+ GLdouble y2 = sc->line_height;
+ GLdouble wx=-1, wy1=-1, wy2=-1, wz=-1;
+
+ glGetDoublev (GL_MODELVIEW_MATRIX, mm);
+ glGetDoublev (GL_PROJECTION_MATRIX, pm);
+ glGetIntegerv (GL_VIEWPORT, vp);
+ gluProject (x, y1, z, mm, pm, vp, &wx, &wy1, &wz);
+ gluProject (x, y2, z, mm, pm, vp, &wx, &wy2, &wz);
+ sc->line_pixel_height = (wy2 - wy1);
+ glLineWidth (1);
+ }
+
+ /* Compute the best looking line thickness for the bottom line.
+ */
+ if (!thick_p)
+ sc->line_thickness = 1.0;
+ else
+ sc->line_thickness = (GLfloat) sc->line_pixel_height / FONT_WEIGHT;
+
+ if (sc->line_thickness < 1.2)
+ sc->line_thickness = 1.0;