--- __osmesa_print__.cc.orig	2015-03-12 11:14:49.585132294 -0700
+++ __osmesa_print__.cc	2015-03-12 11:14:43.321101239 -0700
@@ -156,13 +156,20 @@
   // OSMESA_MINOR_VERSION weren't updated between many releases and
   // can't be used for detection.  (Version 8.0 until 9.1.4 all return
   // MAJOR 6, MINOR 5)
-  int z, s;
+  glEnable (GL_DEPTH_TEST);
+  glEnable (GL_STENCIL_TEST);
+
+  GLint z, s;
+
   glGetIntegerv (GL_DEPTH_BITS, &z);
   glGetIntegerv (GL_STENCIL_BITS, &s);
   if (z != 16 || s != 0)
     error ("__osmesa_print__: Depth and stencil doesn't match,"
            " are you sure you are using OSMesa >= 9.0?");
 
+  glDisable (GL_DEPTH_TEST);
+  glDisable (GL_STENCIL_TEST);
+
   unwind_protect outer_frame;
 
   bool v = fp.is_visible ();
