From http://www.jwz.org/xscreensaver/xscreensaver-5.34.tar.gz
[xscreensaver] / hacks / glx / texfont.c
index b70a32d53358c9eaff2e13740ee35d30a22a7be6..a88b6216cdb0c38b0a9ac4efec2fe6ab179f5b1b 100644 (file)
@@ -655,6 +655,9 @@ print_texture_string (texture_font_data *data, const char *string)
     GLfloat qx0, qy0, qx1, qy1;
     GLfloat tx0, ty0, tx1, ty1;
 
+    /* If face culling is not enabled, draw front and back. */
+    Bool draw_back_face_p = !glIsEnabled (GL_CULL_FACE);
+
     /* Save the prevailing texture environment, and set up ours.
      */
     glGetIntegerv (GL_FRONT_FACE, &ofront);
@@ -690,6 +693,7 @@ print_texture_string (texture_font_data *data, const char *string)
     tx1 = (overall.rbearing - overall.lbearing) / (GLfloat) tex_width;
     ty0 = (overall.ascent + overall.descent)    / (GLfloat) tex_height;
 
+    glEnable (GL_CULL_FACE);
     glFrontFace (GL_CCW);
     glBegin (GL_QUADS);
     glTexCoord2f (tx0, ty0); glVertex3f (qx0, qy0, 0);
@@ -698,6 +702,18 @@ print_texture_string (texture_font_data *data, const char *string)
     glTexCoord2f (tx0, ty1); glVertex3f (qx0, qy1, 0);
     glEnd();
 
+    if (draw_back_face_p)
+      {
+        glFrontFace (GL_CW);
+        glBegin (GL_QUADS);
+        glTexCoord2f (tx0, ty0); glVertex3f (qx0, qy0, 0);
+        glTexCoord2f (tx1, ty0); glVertex3f (qx1, qy0, 0);
+        glTexCoord2f (tx1, ty1); glVertex3f (qx1, qy1, 0);
+        glTexCoord2f (tx0, ty1); glVertex3f (qx0, qy1, 0);
+        glEnd();
+        glDisable (GL_CULL_FACE);
+      }
+
     glPopMatrix();
 
     /* Reset to the caller's texture environment.