diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index c2b13fd913ee291b1a42ae5cd7fbdbee83a07fb1..830a6072bf6c829949d18514a5d6d60d2efb43f5 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.138 2002-09-01 21:54:10 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.139 2002-09-06 19:19:49 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -354,6 +354,18 @@ void _save_ps_accurate(char *name){
   CreateOutputFile(name, FORMAT_PS); 
   CTX.print.eps_quality = old; 
 }
+void _save_eps_simple(char *name){ 
+  int old = CTX.print.eps_quality;
+  CTX.print.eps_quality = 1; 
+  CreateOutputFile(name, FORMAT_EPS); 
+  CTX.print.eps_quality = old; 
+}
+void _save_eps_accurate(char *name){ 
+  int old = CTX.print.eps_quality;
+  CTX.print.eps_quality = 2; 
+  CreateOutputFile(name, FORMAT_EPS); 
+  CTX.print.eps_quality = old; 
+}
 void _save_pstex_simple(char *name){ 
   int old = CTX.print.eps_quality;
   CTX.print.eps_quality = 1; 
@@ -366,6 +378,18 @@ void _save_pstex_accurate(char *name){
   CreateOutputFile(name, FORMAT_PSTEX); 
   CTX.print.eps_quality = old; 
 }
+void _save_epstex_simple(char *name){ 
+  int old = CTX.print.eps_quality;
+  CTX.print.eps_quality = 1; 
+  CreateOutputFile(name, FORMAT_EPSTEX); 
+  CTX.print.eps_quality = old; 
+}
+void _save_epstex_accurate(char *name){     
+  int old = CTX.print.eps_quality;
+  CTX.print.eps_quality = 2; 
+  CreateOutputFile(name, FORMAT_EPSTEX); 
+  CTX.print.eps_quality = old; 
+}
 void _save_jpegtex(char *name){     
   CreateOutputFile(name, FORMAT_JPEGTEX); 
 }
@@ -436,11 +460,13 @@ void file_save_as_cb(CALLBACK_ARGS) {
     { "JPEG (*.jpg)", _save_jpeg },
     { "PostScript fast (*.ps)", _save_ps_simple },
     { "PostScript accurate (*.ps)", _save_ps_accurate },
+    { "Encapsulated PostScript fast (*.eps)", _save_eps_simple },
+    { "Encapsulated PostScript accurate (*.eps)", _save_eps_accurate },
     { "PPM (*.ppm)", _save_ppm },
-    { "LaTeX JPEG (*.jpg)", _save_jpegtex },
-    { "LaTeX PostScript fast (*.ps)", _save_pstex_simple },
-    { "LaTeX PostScript accurate (*.ps)", _save_pstex_accurate },
-    { "LaTeX TeX (*.tex)", _save_tex },
+    { "LaTeX JPEG part (*.jpg)", _save_jpegtex },
+    { "LaTeX EPS part fast (*.ps)", _save_epstex_simple },
+    { "LaTeX EPS part accurate (*.ps)", _save_epstex_accurate },
+    { "LaTeX TeX part (*.tex)", _save_tex },
     { "UCB YUV (*.yuv)", _save_yuv }
   };
 
diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp
index 5cbf8d011f707b6f18f1a5f2f25474f84c583063..212d3b5f8ad6d81bb03454b5bf62dfd6841d7d1b 100644
--- a/Graphics/CreateFile.cpp
+++ b/Graphics/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.32 2002-07-03 23:54:10 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.33 2002-09-06 19:19:49 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -47,7 +47,7 @@ void CreateOutputFile (char *name, int format) {
   FILE    *fp;
   GLint    size3d;
   char     ext[256];
-  int      res, i;
+  int      res, i, psformat, pssort, psoptions;
 
   if(!name || !strlen(name)) return;
 
@@ -72,9 +72,10 @@ void CreateOutputFile (char *name, int format) {
     else if(!strcmp(ext,".jpg")) CreateOutputFile(name, FORMAT_JPEG);
     else if(!strcmp(ext,".jpeg")) CreateOutputFile(name, FORMAT_JPEG);
     else if(!strcmp(ext,".ps")) CreateOutputFile(name, FORMAT_PS);
-    else if(!strcmp(ext,".eps")) CreateOutputFile(name, FORMAT_PS);
+    else if(!strcmp(ext,".eps")) CreateOutputFile(name, FORMAT_EPS);
     else if(!strcmp(ext,".tex")) CreateOutputFile(name, FORMAT_TEX);
     else if(!strcmp(ext,".pstex")) CreateOutputFile(name, FORMAT_PSTEX);
+    else if(!strcmp(ext,".epstex")) CreateOutputFile(name, FORMAT_EPSTEX);
     else if(!strcmp(ext,".jpegtex")) CreateOutputFile(name, FORMAT_JPEGTEX);
     else if(!strcmp(ext,".ppm")) CreateOutputFile(name, FORMAT_PPM);
     else if(!strcmp(ext,".yuv")) CreateOutputFile(name, FORMAT_YUV);
@@ -173,20 +174,25 @@ void CreateOutputFile (char *name, int format) {
 
   case FORMAT_PS :
   case FORMAT_PSTEX :
+  case FORMAT_EPS :
+  case FORMAT_EPSTEX :
     if(!(fp = fopen(name,"w"))) {
       Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
+    psformat = (format==FORMAT_PS || format==FORMAT_PSTEX) ? GL2PS_PS : GL2PS_EPS;
+    pssort = (CTX.print.eps_quality==1) ? GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT;
+    psoptions = GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT |
+      (CTX.print.eps_background ? GL2PS_DRAW_BACKGROUND : 0) |
+      (format==FORMAT_PSTEX ? GL2PS_NO_TEXT : 0) |
+      (format==FORMAT_EPSTEX ? GL2PS_NO_TEXT : 0);
+
     size3d = 0 ;
     res = GL2PS_OVERFLOW ;
+
     while(res == GL2PS_OVERFLOW){
       size3d += 2048*2048 ;
-      gl2psBeginPage(CTX.base_filename, "Gmsh", 
-		     GL2PS_PS,
-		     (CTX.print.eps_quality == 1 ? GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT),
-		     GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT |
-		     (CTX.print.eps_background ? GL2PS_DRAW_BACKGROUND : 0) |
-		     (format==FORMAT_PSTEX ? GL2PS_NO_TEXT : 0),
+      gl2psBeginPage(CTX.base_filename, "Gmsh", psformat, pssort, psoptions,
 		     GL_RGBA, 0, NULL, size3d, fp, name);
       CTX.print.gl_fonts = 0;
       FillBuffer();
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 5a085bccd144c8aee075409f78cd11015b1a5545..56018a27e5adf5b3be6fc1be3da2cb4348de8e3e 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -2,7 +2,7 @@
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2002  Christophe Geuzaine 
  *
- * $Id: gl2ps.cpp,v 1.49 2002-06-21 21:09:11 geuzaine Exp $
+ * $Id: gl2ps.cpp,v 1.50 2002-09-06 19:19:49 geuzaine Exp $
  *
  * E-mail: geuz@geuz.org
  * URL: http://www.geuz.org/gl2ps/
@@ -945,32 +945,41 @@ GLvoid gl2psPrintPostScriptHeader(GLvoid){
 
   glGetIntegerv(GL_VIEWPORT, viewport);
 
+  if(gl2ps->format == GL2PS_PS)
+    fprintf(gl2ps->stream, "%%!PS-Adobe-3.0\n");
+  else if(gl2ps->format == GL2PS_EPS)
+    fprintf(gl2ps->stream, "%%!PS-Adobe-3.0 EPSF-3.0\n");
+  else
+    gl2psMsg(GL2PS_ERROR, "Unknown PostScript format");
+
   fprintf(gl2ps->stream, 
-	  "%%!PS-Adobe-3.0\n"
 	  "%%%%Title: %s\n"
 	  "%%%%Creator: GL2PS, an OpenGL to PostScript Printing Library, v. %g\n"
 	  "%%%%For: %s\n"
 	  "%%%%CreationDate: %s"
 	  "%%%%LanguageLevel: 3\n"
 	  "%%%%DocumentData: Clean7Bit\n"
-	  "%%%%Pages: 1\n"
-	  "%%%%PageOrder: Ascend\n"
-	  "%%%%Orientation: %s\n"
-	  "%%%%DocumentMedia: Default %d %d 0 () ()\n"
+	  "%%%%Pages: 1\n",
+	  gl2ps->title, GL2PS_VERSION, gl2ps->producer, ctime(&now));
+
+  if(gl2ps->format == GL2PS_PS)
+    fprintf(gl2ps->stream, 
+	    "%%%%Orientation: %s\n"
+	    "%%%%DocumentMedia: Default %d %d 0 () ()\n",
+	    (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait",
+	    (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[3] : viewport[2],
+	    (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[2] : viewport[3]);
+
+  fprintf(gl2ps->stream,
 	  "%%%%BoundingBox: %d %d %d %d\n"
 	  "%%%%Copyright: GNU LGPL (C) 1999-2002 Christophe Geuzaine <geuz@geuz.org>\n"
 	  "%%%%EndComments\n",
-	  gl2ps->title, GL2PS_VERSION, gl2ps->producer, ctime(&now),
-	  (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait",
-	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[3] : viewport[2],
-	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[2] : viewport[3],
 	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[1] : viewport[0],
 	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[0] : viewport[1],
 	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[3] : viewport[2],
 	  (gl2ps->options & GL2PS_LANDSCAPE) ? viewport[2] : viewport[3]);
 
-  /* 
-     RGB color: r g b C (replace C by G in output to change from rgb to gray)
+  /* RGB color: r g b C (replace C by G in output to change from rgb to gray)
      Grayscale: r g b G
      Font choose: size fontname FC
      String primitive: (string) x y size fontname S
@@ -979,8 +988,7 @@ GLvoid gl2psPrintPostScriptHeader(GLvoid){
      Flat-shaded line: x2 y2 x1 y1 L
      Smooth-shaded line: x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 SL
      Flat-shaded triangle: x3 y3 x2 y2 x1 y1 T
-     Smooth-shaded triangle: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 ST
-  */
+     Smooth-shaded triangle: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 ST */
 
   fprintf(gl2ps->stream,
 	  "%%%%BeginProlog\n"
@@ -996,32 +1004,97 @@ GLvoid gl2psPrintPostScriptHeader(GLvoid){
 	  "/P  { newpath 0.0 360.0 arc closepath fill } BD\n"
 	  "/L  { newpath moveto lineto stroke } BD\n"
 	  "/SL { C moveto C lineto stroke } BD\n"
-	  "/T  { newpath moveto lineto lineto closepath fill } BD\n"
-	  "/STshfill { /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+	  "/T  { newpath moveto lineto lineto closepath fill } BD\n");
+
+  /* Smooth-shaded triangle with PostScript level 3 shfill operator:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STshfill */
+
+  fprintf(gl2ps->stream,
+	  "/STshfill {\n"
+	  "      /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
 	  "      /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
 	  "      /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
 	  "      gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n"
 	  "      /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n"
-	  "      shfill grestore } BD\n"
-	  "/STnoshfill {/b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
-	  "      /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
-	  "      /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"    
-	  "      b2 b1 sub abs 0.05 gt g2 g1 sub abs 0.017 gt r2 r1 sub abs 0.032 gt\n"
-	  "      b3 b1 sub abs 0.05 gt g3 g1 sub abs 0.017 gt r3 r1 sub abs 0.032 gt\n"
-	  "      b2 b3 sub abs 0.05 gt g2 g3 sub abs 0.017 gt r2 r3 sub abs 0.032 gt\n"
-	  "      or or or or or or or or { /b12 b1 b2 add 0.5 mul def /g12 g1 g2 add\n"
-	  "      0.5 mul def /r12 r1 r2 add 0.5 mul def /y12 y1 y2 add 0.5 mul def\n"
-	  "      /x12 x1 x2 add 0.5 mul def /b13 b1 b3 add 0.5 mul def /g13 g1 g3\n"
-	  "      add 0.5 mul def /r13 r1 r3 add 0.5 mul def /y13 y1 y3 add 0.5 mul\n"
-	  "      def /x13 x1 x3 add 0.5 mul def /b32 b3 b2 add 0.5 mul def\n"
-	  "      /g32 g3 g2 add 0.5 mul def /r32 r3 r2 add 0.5 mul def /y32 y3 y2\n"
-	  "      add 0.5 mul def /x32 x3 x2 add 0.5 mul def x1 y1 r1 g1 b1 x12 y12\n"
-	  "      r12 g12 b12 x13 y13 r13 g13 b13 x2 y2 r2 g2 b2 x12 y12 r12 g12 b12\n"
-	  "      x32 y32 r32 g32 b32 x3 y3 r3 g3 b3 x32 y32 r32 g32 b32 x13 y13 r13\n"
-	  "      g13 b13 x32 y32 r32 g32 b32 x12 y12 r12 g12 b12 x13 y13 r13 g13 b13\n"
-	  "      STnoshfill STnoshfill STnoshfill STnoshfill }\n" 
-	  "      { r1 g1 b1 C x1 y1 x2 y2 x3 y3 T } ifelse } def\n"
-	  "/shfill where { pop /ST { STshfill } BD } { /ST { STnoshfill } BD } ifelse\n"
+	  "      shfill grestore } BD\n");
+
+  /* Flat-shaded triangle with middle color:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 Tm */
+
+  fprintf(gl2ps->stream,
+          /* stack : x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 */
+          "/Tm { 3 -1 roll 8 -1 roll 13 -1 roll add add 3 div\n" /* r = (r1+r2+r3)/3 */
+          /* stack : x3 y3 g3 b3 x2 y2 g2 b2 x1 y1 g1 b1 r */
+          "      3 -1 roll 7 -1 roll 11 -1 roll add add 3 div\n" /* g = (g1+g2+g3)/3 */
+          /* stack : x3 y3 b3 x2 y2 b2 x1 y1 b1 r g b */
+          "      3 -1 roll 6 -1 roll 9 -1 roll add add 3 div" /* b = (b1+b2+b3)/3 */
+          /* stack : x3 y3 x2 y2 x1 y1 r g b */
+          " C T } BD\n");
+
+  /* Split triangle in four sub-triangles (at sides middle points) and call the
+     STnoshfill procedure on each, interpolating the colors in RGB space:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STsplit
+     (in procedure comments key: (Vi) = xi yi ri gi bi) */
+
+  fprintf(gl2ps->stream,
+          "/STsplit {\n"
+          "      4 index 15 index add 0.5 mul\n" /* x13 = (x1+x3)/2 */
+          "      4 index 15 index add 0.5 mul\n" /* y13 = (y1+y3)/2 */
+          "      4 index 15 index add 0.5 mul\n" /* r13 = (r1+r3)/2 */
+          "      4 index 15 index add 0.5 mul\n" /* g13 = (g1+g3)/2 */
+          "      4 index 15 index add 0.5 mul\n" /* b13 = (b1+b3)/2 */
+          "      5 copy 5 copy 25 15 roll\n"
+          /* stack : (V3) (V13) (V13) (V13) (V2) (V1) */
+          "      9 index 30 index add 0.5 mul\n" /* x23 = (x2+x3)/2 */
+          "      9 index 30 index add 0.5 mul\n" /* y23 = (y2+y3)/2 */
+          "      9 index 30 index add 0.5 mul\n" /* r23 = (r2+r3)/2 */
+          "      9 index 30 index add 0.5 mul\n" /* g23 = (g2+g3)/2 */
+          "      9 index 30 index add 0.5 mul\n" /* b23 = (b2+b3)/2 */
+          "      5 copy 5 copy 35 5 roll 25 5 roll 15 5 roll\n"
+          /* stack : (V3) (V13) (V23) (V13) (V23) (V13) (V23) (V2) (V1) */
+          "      4 index 10 index add 0.5 mul\n" /* x12 = (x1+x2)/2 */
+          "      4 index 10 index add 0.5 mul\n" /* y12 = (y1+y2)/2 */
+          "      4 index 10 index add 0.5 mul\n" /* r12 = (r1+r2)/2 */
+          "      4 index 10 index add 0.5 mul\n" /* g12 = (g1+g2)/2 */
+          "      4 index 10 index add 0.5 mul\n" /* b12 = (b1+b2)/2 */
+          "      5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n"
+          /* stack : (V3) (V13) (V23) (V13) (V12) (V23) (V13) (V1) (V12) (V23) (V12) (V2) */
+          "      STnoshfill STnoshfill STnoshfill STnoshfill } BD\n");
+
+  /* Gourad shaded triangle using recursive subdivision until the difference
+     between corner colors does not exceed the thresholds:
+        x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STnoshfill  */
+
+  fprintf(gl2ps->stream,
+          "/STnoshfill {\n"
+	  "      2 index 8 index sub abs %g gt { STsplit }\n" /* |r1-r2|>rth */
+          "      { 1 index 7 index sub abs %g gt { STsplit }\n" /* |g1-g2|>gth */
+          "        { dup 6 index sub abs %g gt { STsplit }\n" /* |b1-b2|>bth */
+          "          { 2 index 13 index sub abs %g gt { STsplit }\n" /* |r1-r3|>rht */
+          "            { 1 index 12 index sub abs %g gt { STsplit }\n" /* |g1-g3|>gth */
+          "              { dup 11 index sub abs %g gt { STsplit }\n" /* |b1-b3|>bth */
+          "                { 7 index 13 index sub abs %g gt { STsplit }\n" /* |r2-r3|>rht */
+          "                  { 6 index 12 index sub abs %g gt { STsplit }\n" /* |g2-g3|>gth */
+          "                    { 5 index 11 index sub abs %g gt { STsplit }\n" /* |b2-b3|>bth */
+          "                      { Tm\n" /* all colors sufficiently similar */
+          "                      } ifelse\n"
+          "                    } ifelse\n"
+          "                  } ifelse\n"
+          "                } ifelse\n"
+          "              } ifelse\n"
+          "            } ifelse\n"
+          "          } ifelse\n"
+          "        } ifelse\n"
+          "      } ifelse } BD\n",
+          gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2],
+          gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2],
+          gl2ps->threshold[0], gl2ps->threshold[1], gl2ps->threshold[2]);
+
+  fprintf(gl2ps->stream,
+	  (gl2ps->options & GL2PS_NO_PS3_SHADING) ? "/ST { STnoshfill } BD\n" :
+	  "/shfill where { pop /ST { STshfill } BD } { /ST { STnoshfill } BD } ifelse\n");
+
+  fprintf(gl2ps->stream,
 	  "end\n"
 	  "%%%%EndProlog\n"
 	  "%%%%BeginSetup\n"
@@ -1227,6 +1300,9 @@ GL2PSDLL_API GLvoid gl2psBeginPage(char *title, char *producer,
   gl2ps->filename = filename;
   gl2ps->sort = sort;
   gl2ps->options = options;
+  gl2ps->threshold[0] = 0.032;
+  gl2ps->threshold[1] = 0.017;
+  gl2ps->threshold[2] = 0.05;
   gl2ps->colormode = colormode;
   gl2ps->buffersize = buffersize > 0 ? buffersize : 2048 * 2048;
   gl2ps->feedback = (GLfloat*)gl2psMalloc(gl2ps->buffersize * sizeof(GLfloat));
@@ -1274,7 +1350,7 @@ GL2PSDLL_API GLint gl2psEndPage(GLvoid){
   glGetIntegerv(GL_SHADE_MODEL, &shademodel);
   gl2ps->shade = (shademodel == GL_SMOOTH);
 
-  if(gl2ps->format & GL2PS_TEX)
+  if(gl2ps->format == GL2PS_TEX)
     res = GL2PS_SUCCESS;
   else
     res = gl2psParseFeedbackBuffer();
@@ -1290,6 +1366,7 @@ GL2PSDLL_API GLint gl2psEndPage(GLvoid){
       pfoot = gl2psPrintTeXFooter;
       break;
     case GL2PS_PS :
+    case GL2PS_EPS :
       phead = gl2psPrintPostScriptHeader;
       pprim = gl2psPrintPostScriptPrimitive;
       pfoot = gl2psPrintPostScriptFooter;
@@ -1373,7 +1450,7 @@ GL2PSDLL_API GLvoid gl2psText(char *str, char *fontname, GLint fontsize){
   glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba);
   prim->text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring));
   prim->text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char));
-  strcpy(prim->text->str, str);
+  strcpy(prim->text->str, str); 
   prim->text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char));
   strcpy(prim->text->fontname, fontname);
   prim->text->fontsize = fontsize;
@@ -1435,3 +1512,11 @@ GL2PSDLL_API GLvoid gl2psLineWidth(GLfloat value){
   glPassThrough(value);
 }
 
+GL2PSDLL_API GLvoid gl2psNumShadeColors(GLint nr, GLint ng, GLint nb){
+  if(!gl2ps) return;
+
+  gl2ps->threshold[0] = nr ? 1./(GLfloat)nr : 1.;
+  gl2ps->threshold[1] = ng ? 1./(GLfloat)ng : 1.;
+  gl2ps->threshold[2] = nb ? 1./(GLfloat)nb : 1.;
+}
+
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index 71bcc7f50100667d402d9bba32f4dbf665dc5987..fc1ec7c2e0dc600f426765c04b8eb0d26e1d6241 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -2,7 +2,7 @@
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2002  Christophe Geuzaine
  *
- * $Id: gl2ps.h,v 1.27 2002-06-21 17:15:17 geuzaine Exp $
+ * $Id: gl2ps.h,v 1.28 2002-09-06 19:19:49 geuzaine Exp $
  *
  * E-mail: geuz@geuz.org
  * URL: http://www.geuz.org/gl2ps/
@@ -55,13 +55,14 @@
 #endif /* __APPLE__ */
 
 
-#define GL2PS_VERSION                    0.61
+#define GL2PS_VERSION                    0.62
 #define GL2PS_NONE                       0
 
 /* Output file format */
 
 #define GL2PS_PS                         1
-#define GL2PS_TEX                        2
+#define GL2PS_EPS                        2
+#define GL2PS_TEX                        3
 
 /* Sorting algorithms */
 
@@ -78,6 +79,7 @@
 #define GL2PS_OCCLUSION_CULL             (1<<4)
 #define GL2PS_NO_TEXT                    (1<<5)
 #define GL2PS_LANDSCAPE                  (1<<6)
+#define GL2PS_NO_PS3_SHADING             (1<<7)
 
 /* Arguments for gl2psEnable/gl2psDisable */
 
@@ -171,7 +173,7 @@ typedef struct {
   char *title, *producer, *filename;
   GLboolean shade, boundary;
   GLfloat *feedback, offset[2];
-  GL2PSrgba *colormap, lastrgba;
+  GL2PSrgba *colormap, lastrgba, threshold;
   float lastlinewidth;
   GL2PSlist *primitives;
   FILE *stream;
@@ -195,6 +197,7 @@ GL2PSDLL_API GLvoid gl2psEnable(GLint mode);
 GL2PSDLL_API GLvoid gl2psDisable(GLint mode);
 GL2PSDLL_API GLvoid gl2psPointSize(GLfloat value);
 GL2PSDLL_API GLvoid gl2psLineWidth(GLfloat value);
+GL2PSDLL_API GLvoid gl2psNumShadeColors(GLint nr, GLint ng, GLint nb);
 
 #ifdef __cplusplus
 };
diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h
index c16374323eb8845c743ed72ccad6d02be81f34cf..dc005838fedf5037570bf5f383835e330fd95e30 100644
--- a/Mesh/Mesh.h
+++ b/Mesh/Mesh.h
@@ -43,6 +43,8 @@
 #define FORMAT_JPEGTEX 17
 #define FORMAT_TEX     18
 #define FORMAT_VRML    19
+#define FORMAT_EPS     20
+#define FORMAT_EPSTEX  21
 
 #define CONV_VALUE    0.8