diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index e05fc0bda55e10f29dba52ec3c89a7ed14a75d12..21f3f622dce7d74d7038765a45c4fb44fb8e2137 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -1,4 +1,4 @@
-// $Id: CommandLine.cpp,v 1.39 2004-05-17 18:04:53 geuzaine Exp $
+// $Id: CommandLine.cpp,v 1.40 2004-05-29 10:11:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -89,7 +89,6 @@ void Print_Usage(char *name){
 #if defined(HAVE_FLTK)
   Msg(DIRECT, "  -interactive          display 2D mesh construction interactively");
   Msg(DIRECT, "Post-processing options:");
-  Msg(DIRECT, "  -dl                   enable display lists");
   Msg(DIRECT, "  -noview               hide all views on startup");
   Msg(DIRECT, "  -link int             select link mode between views (default: 0)");
   Msg(DIRECT, "  -smoothview           smooth views");
@@ -543,14 +542,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles)
         CTX.db = 0;
         i++;
       }
-      else if(!strcmp(argv[i] + 1, "dl")) {
-        CTX.post.display_lists = 1;
-        i++;
-      }
-      else if(!strcmp(argv[i] + 1, "nodl")) {
-        CTX.post.display_lists = 0;
-        i++;
-      }
       else if(!strcmp(argv[i] + 1, "fontsize")) {
         i++;
         if(argv[i] != NULL) {
diff --git a/Common/Context.h b/Common/Context.h
index 7adc19487455eabc5bc9adeca0707ece2c491da3..7b31ed1e89723ed67c5646b403bdce5a8cf775ae 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -185,7 +185,7 @@ public :
   // post processing options 
   struct{
     List_T *list ;
-    int force_num, compute_bb, display_lists;
+    int force_num, compute_bb, vertex_arrays;
     int draw, scales, link ;
     int smooth, anim_cycle, combine_time ;
     double anim_delay ;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 2526e78b958bc2abf81c45766203cff5ccf2ae8e..5d591e1b9cb027142077ad70502937a0ec9381b5 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -878,9 +878,6 @@ StringXNumber PostProcessingOptions_Number[] = {
   { F|O, "AnimationCycle" , opt_post_anim_cycle , 0. ,
     "Cycle through views instead of time steps in automatic animation mode" },
 
-  { F|O, "DisplayLists" , opt_post_display_lists , 0. ,
-    "Use OpenGL display lists for drawing post-processing views" },
-
   { F|O, "Link" , opt_post_link , 0. ,
     "Link post-processing views (0=none, 1,2=changes in visible/all, 3,4=everything in visible/all)" },
 
@@ -892,6 +889,9 @@ StringXNumber PostProcessingOptions_Number[] = {
   { F|O, "Smoothing" , opt_post_smooth , 0. ,
     "Apply (non-reversible) smoothing to post-processing view when merged" },
 
+  { F|O, "VertexArrays" , opt_post_vertex_arrays , 1. ,
+    "Use OpenGL vertex arrays to draw triangles in post-processing views?" },
+
   { 0, NULL , NULL , 0. }
 } ;
 
diff --git a/Common/Makefile b/Common/Makefile
index 27d9a8b59506c2b6ecd5c03e617eacd7ee948034..265405943d206b0e783f98319c728a04e2957e27 100644
--- a/Common/Makefile
+++ b/Common/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.56 2004-05-25 23:16:25 geuzaine Exp $
+# $Id: Makefile,v 1.57 2004-05-29 10:11:10 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -34,6 +34,7 @@ SRC = Context.cpp\
       ColorTable.cpp\
       Visibility.cpp\
       Trackball.cpp\
+      VertexArray.cpp\
       License.cpp
 
 OBJ = ${SRC:.cpp=.o}
@@ -63,28 +64,30 @@ Context.o: Context.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h Context.h \
-  Options.h DefaultOptions.h Trackball.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h Context.h Options.h DefaultOptions.h Trackball.h
 Views.o: Views.cpp Gmsh.h Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
-  ../Numeric/Numeric.h Views.h ColorTable.h Context.h Options.h
+  ../Numeric/Numeric.h Views.h ColorTable.h VertexArray.h Context.h \
+  Options.h
 Options.o: Options.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h Gmsh.h ../DataStr/Malloc.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h GmshUI.h \
-  ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
-  ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h ../Graphics/Draw.h \
-  Context.h ../Fltk/Solvers.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
-  ../Fltk/Colorbar_Window.h
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h Gmsh.h \
+  ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
+  ../DataStr/Tools.h GmshUI.h ../Geo/Geo.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
+  ../Mesh/Matrix.h ../Graphics/Draw.h Context.h ../Fltk/Solvers.h \
+  ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h
 CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   GmshUI.h GmshVersion.h CommandLine.h ../Numeric/Numeric.h Context.h \
   Options.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  Views.h ColorTable.h ../Parser/OpenFile.h ../Parser/Parser.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Views.h ColorTable.h \
+  ../Parser/OpenFile.h ../Parser/Parser.h
 Timer.o: Timer.cpp
 ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -93,8 +96,11 @@ Visibility.o: Visibility.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Parser/Parser.h Visibility.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Parser/Parser.h Visibility.h
 Trackball.o: Trackball.cpp Trackball.h
+VertexArray.o: VertexArray.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
+  ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  VertexArray.h Context.h
 License.o: License.cpp Gmsh.h Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h
diff --git a/Common/Options.cpp b/Common/Options.cpp
index bcfac165cf2e27d0bbf6c562efaddbdb8dafe61d..a0786da787af3aa1d3a87182c5ddf92033dee27c 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.158 2004-05-28 23:11:56 geuzaine Exp $
+// $Id: Options.cpp,v 1.159 2004-05-29 10:11:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -2320,7 +2320,7 @@ double opt_general_alpha_blending(OPT_ARGS_NUM)
     CTX.alpha = (int)val;
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI))
-    WID->gen_butt[5]->value(CTX.alpha);
+    WID->gen_butt[4]->value(CTX.alpha);
 #endif
   return CTX.alpha;
 }
@@ -2403,7 +2403,7 @@ double opt_general_trackball(OPT_ARGS_NUM)
     CTX.useTrackball = (int)val;
 #if defined(HAVE_FLTK)
   if(WID && (action & GMSH_GUI))
-    WID->gen_butt[6]->value(CTX.useTrackball);
+    WID->gen_butt[5]->value(CTX.useTrackball);
 #endif
   return CTX.useTrackball;
 }
@@ -3817,20 +3817,12 @@ double opt_solver_merge_views4(OPT_ARGS_NUM)
   return opt_solver_merge_views(4, action, val);
 }
 
-double opt_post_display_lists(OPT_ARGS_NUM)
+double opt_post_vertex_arrays(OPT_ARGS_NUM)
 {
-  int i;
   if(action & GMSH_SET) {
-    CTX.post.display_lists = (int)val;
-    if(CTX.post.display_lists)
-      for(i = 0; i < List_Nbr(CTX.post.list); i++)
-        ((Post_View *) List_Pointer_Test(CTX.post.list, i))->Changed = 1;
+    CTX.post.vertex_arrays = (int)val;
   }
-#if defined(HAVE_FLTK)
-  if(WID && (action & GMSH_GUI))
-    WID->gen_butt[4]->value(CTX.post.display_lists);
-#endif
-  return CTX.post.display_lists;
+  return CTX.post.vertex_arrays;
 }
 
 double opt_post_scales(OPT_ARGS_NUM)
@@ -4066,7 +4058,6 @@ double opt_view_arrow_size(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->ArrowSize = val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4082,7 +4073,6 @@ double opt_view_arrow_head_radius(OPT_ARGS_NUM)
     if(val < 0.) val = 0.;
     if(val > 1.) val = 1.;
     v->ArrowRelHeadRadius = val;
-    v->Changed = 1;
   }
   return v->ArrowRelHeadRadius;
 }
@@ -4094,7 +4084,6 @@ double opt_view_arrow_stem_length(OPT_ARGS_NUM)
     if(val < 0.) val = 0.;
     if(val > 1.) val = 1.;
     v->ArrowRelStemLength = val;
-    v->Changed = 1;
   }
   return v->ArrowRelStemLength;
 }
@@ -4106,7 +4095,6 @@ double opt_view_arrow_stem_radius(OPT_ARGS_NUM)
     if(val < 0.) val = 0.;
     if(val > 1.) val = 1.;
     v->ArrowRelStemRadius = val;
-    v->Changed = 1;
   }
   return v->ArrowRelStemRadius;
 }
@@ -4240,7 +4228,6 @@ double opt_view_position0(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Position[0] = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4254,7 +4241,6 @@ double opt_view_position1(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Position[1] = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4268,7 +4254,6 @@ double opt_view_auto_position(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->AutoPosition = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
@@ -4283,7 +4268,6 @@ double opt_view_size0(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Size[0] = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4297,7 +4281,6 @@ double opt_view_size1(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Size[1] = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4311,7 +4294,6 @@ double opt_view_grid(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Grid = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
@@ -4326,7 +4308,6 @@ double opt_view_nb_abscissa(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->NbAbscissa = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
@@ -4370,7 +4351,6 @@ double opt_view_light(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->Light = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4412,7 +4392,6 @@ double opt_view_show_element(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->ShowElement = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4452,7 +4431,6 @@ double opt_view_draw_strings(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->DrawStrings = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4466,7 +4444,6 @@ double opt_view_draw_points(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->DrawPoints = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4480,7 +4457,6 @@ double opt_view_draw_lines(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->DrawLines = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4748,7 +4724,6 @@ double opt_view_arrow_location(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->ArrowLocation = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
@@ -4771,7 +4746,6 @@ double opt_view_point_size(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->PointSize = val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4785,7 +4759,6 @@ double opt_view_line_width(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->LineWidth = val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num))
@@ -4799,7 +4772,6 @@ double opt_view_point_type(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->PointType = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
@@ -4814,7 +4786,6 @@ double opt_view_line_type(OPT_ARGS_NUM)
   GET_VIEW(0.);
   if(action & GMSH_SET) {
     v->LineType = (int)val;
-    v->Changed = 1;
   }
 #if defined(HAVE_FLTK)
   if(_gui_action_valid(action, num)) {
diff --git a/Common/Options.h b/Common/Options.h
index ea9f3794962333fd2c1ac614cabc310085e76cf4..2c68529ec208d06c2d8c296f15b84540ffb1d5e9 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -409,7 +409,7 @@ double opt_solver_merge_views1(OPT_ARGS_NUM);
 double opt_solver_merge_views2(OPT_ARGS_NUM);
 double opt_solver_merge_views3(OPT_ARGS_NUM);
 double opt_solver_merge_views4(OPT_ARGS_NUM);
-double opt_post_display_lists(OPT_ARGS_NUM);
+double opt_post_vertex_arrays(OPT_ARGS_NUM);
 double opt_post_scales(OPT_ARGS_NUM);
 double opt_post_link(OPT_ARGS_NUM);
 double opt_post_smooth(OPT_ARGS_NUM);
diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..59b98f978f2428172f704303f110a19e01702427
--- /dev/null
+++ b/Common/VertexArray.cpp
@@ -0,0 +1,127 @@
+// $Id: VertexArray.cpp,v 1.1 2004-05-29 10:11:10 geuzaine Exp $
+//
+// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include "Gmsh.h"
+#include "VertexArray.h"
+#include "Context.h"
+#include "Numeric.h"
+
+triangleVertexArray::triangleVertexArray(int nb)
+{
+  num_triangles = 0;
+  vertices = List_Create(nb * 3 * 3, 9000, sizeof(float));
+  normals = List_Create(nb * 3 * 3, 9000, sizeof(float));
+  colors = List_Create(nb * 3 * 4, 12000, sizeof(unsigned char));
+}
+
+triangleVertexArray::~triangleVertexArray()
+{
+  List_Delete(vertices);
+  List_Delete(normals);
+  List_Delete(colors);
+}
+
+void triangleVertexArray::add(float x, float y, float z, float n0, 
+			      float n1, float n2, unsigned int col)
+{
+  unsigned char r = UNPACK_RED(col);
+  unsigned char g = UNPACK_GREEN(col);
+  unsigned char b = UNPACK_BLUE(col);
+  unsigned char a = UNPACK_ALPHA(col);
+  List_Add(vertices, &x);
+  List_Add(vertices, &y);
+  List_Add(vertices, &z);
+  List_Add(normals, &n0);
+  List_Add(normals, &n1);
+  List_Add(normals, &n2);
+  List_Add(colors, &r);
+  List_Add(colors, &g);
+  List_Add(colors, &b);
+  List_Add(colors, &a);
+}
+
+static double theeye[3];
+
+int compareTriEye(const void *a, const void *b)
+{
+  float *q = (float*)a;
+  float *w = (float*)b;
+  double d, dq, dw, cgq[3] = { 0., 0., 0. }, cgw[3] = { 0., 0., 0.};
+  for(int i = 0; i < 3; i++) {
+    cgq[0] += q[3*i];
+    cgq[1] += q[3*i + 1];
+    cgq[2] += q[3*i + 2];
+    cgw[0] += w[3*i];
+    cgw[1] += w[3*i + 1];
+    cgw[2] += w[3*i + 2];
+  }
+  prosca(theeye, cgq, &dq);
+  prosca(theeye, cgw, &dw);
+  d = dq - dw;
+  if(d > 0)
+    return 1;
+  if(d < 0)
+    return -1;
+  return 0;
+}
+
+void triangleVertexArray::sort(double eye[3])
+{
+  theeye[0] = eye[0];
+  theeye[1] = eye[1];
+  theeye[2] = eye[2];
+  
+  int nb = List_Nbr(vertices) + List_Nbr(normals) + List_Nbr(colors);
+  float *tmp = new float[nb];
+  
+  int iv = 0, in = 0, ic = 0, k = 0;
+  for(int i = 0; i < num_triangles; i++){
+    for(int j = 0; j < 9; j++)
+      List_Read(vertices, iv++, &tmp[k++]);
+    for(int j = 0; j < 9; j++)
+      List_Read(normals, in++, &tmp[k++]);
+    for(int j = 0; j < 12; j++){
+      unsigned char c;
+      List_Read(colors, ic++, &c);
+      tmp[k++] = c;
+    }
+  }
+
+  List_Reset(vertices);
+  List_Reset(normals);
+  List_Reset(colors);
+
+  qsort(tmp, num_triangles, (9+9+12)*sizeof(float), compareTriEye);
+
+  k = 0;
+  for(int i = 0; i < num_triangles; i++){
+    for(int j = 0; j < 9; j++)
+      List_Add(vertices, &tmp[k++]);
+    for(int j = 0; j < 9; j++)
+      List_Add(normals, &tmp[k++]);
+    for(int j = 0; j < 12; j++){
+      unsigned char c = (unsigned char)tmp[k++];
+      List_Add(colors, &c);
+    }
+  }  
+
+  delete [] tmp;
+}
diff --git a/Common/VertexArray.h b/Common/VertexArray.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b621972b57936c595b5866bd7a8210df5dc0e3d
--- /dev/null
+++ b/Common/VertexArray.h
@@ -0,0 +1,36 @@
+#ifndef _VERTEX_ARRAY_H_
+#define _VERTEX_ARRAY_H_
+
+// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+// 
+// Please report all bugs and problems to <gmsh@geuz.org>.
+
+#include "List.h"
+
+class triangleVertexArray{
+ public:
+  int num_triangles;
+  List_T *vertices, *normals, *colors;
+  triangleVertexArray(int nb);
+  ~triangleVertexArray();
+  void add(float x, float y, float z, float n0, 
+	   float n1, float n2, unsigned int col);
+  void sort(double eye[3]);
+};
+
+#endif
diff --git a/Common/Views.cpp b/Common/Views.cpp
index 2f151c0b41ff24751905bdbd9ee11192e17352cb..0e8874778d07ee936df9187e30c3604390d20a8a 100644
--- a/Common/Views.cpp
+++ b/Common/Views.cpp
@@ -1,4 +1,4 @@
-// $Id: Views.cpp,v 1.118 2004-05-22 01:24:16 geuzaine Exp $
+// $Id: Views.cpp,v 1.119 2004-05-29 10:11:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -72,7 +72,9 @@ Post_View *BeginView(int allocate)
 
   v->Index = i;
   v->Dirty = 1;
-  v->DisplayListNum = -1;
+  v->VertexArray = NULL;
+  v->FillVertexArray = 0;
+  v->UseVertexArray = 0;
   v->NbTimeStep = 0;
   v->TimeStepMin = NULL;
   v->TimeStepMax = NULL;
@@ -594,6 +596,9 @@ void FreeView(Post_View * v)
     v->T2D = v->T2C = NULL;
     v->T3D = v->T3C = NULL;
     v->reset_normals();
+    if(v->VertexArray) 
+      delete v->VertexArray;
+    v->VertexArray = NULL;
   }
 
 }
diff --git a/Common/Views.h b/Common/Views.h
index 53ca4e01d641ed3776128fea71da6c4cdc612f12..f39a3af4d4d9eb6fa20365e3a51676252da88b02 100644
--- a/Common/Views.h
+++ b/Common/Views.h
@@ -22,6 +22,7 @@
 
 #include "ColorTable.h"
 #include "List.h"
+#include "VertexArray.h"
 
 #define VIEW_NB_ELEMENT_TYPES  (8*3)
 #define VIEW_MAX_ELEMENT_NODES  8
@@ -32,7 +33,7 @@ class smooth_container;
 class Post_View{
   public :
   // intrinsic to a view
-  int Num, Index, Changed, DuplicateOf, Links, Dirty, DisplayListNum;
+  int Num, Index, Changed, DuplicateOf, Links, Dirty;
   char FileName[256], Name[256], AbscissaName[256];
 
   // the data
@@ -59,6 +60,10 @@ class Post_View{
   int NbT2, NbT3;
   List_T *T2D, *T2C, *T3D, *T3C; // 2D and 3D text strings
 
+  // a vertex array to draw triangles efficiently
+  triangleVertexArray *VertexArray;
+  int FillVertexArray, UseVertexArray;
+
   // options
   int Type, Position[2], AutoPosition, Size[2];
   char   Format[256], AbscissaFormat[256];
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 5107ee1287d8430d79ef3fd139d03bf817b092f5..1a1704f66a0e296487594981327090bd0b7da30e 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.241 2004-05-28 19:22:12 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.242 2004-05-29 10:11:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -853,9 +853,8 @@ void general_options_ok_cb(CALLBACK_ARGS)
   opt_general_fast_redraw(0, GMSH_SET, WID->gen_butt[2]->value());
   if(opt_general_double_buffer(0, GMSH_GET, 0) != WID->gen_butt[3]->value())
     opt_general_double_buffer(0, GMSH_SET, WID->gen_butt[3]->value());
-  opt_post_display_lists(0, GMSH_SET, WID->gen_butt[4]->value());       //this has to move
-  opt_general_alpha_blending(0, GMSH_SET, WID->gen_butt[5]->value());
-  opt_general_trackball(0, GMSH_SET, WID->gen_butt[6]->value());
+  opt_general_alpha_blending(0, GMSH_SET, WID->gen_butt[4]->value());
+  opt_general_trackball(0, GMSH_SET, WID->gen_butt[5]->value());
   opt_general_terminal(0, GMSH_SET, WID->gen_butt[7]->value());
   double sessionrc = opt_general_session_save(0, GMSH_GET, 0);
   opt_general_session_save(0, GMSH_SET, WID->gen_butt[8]->value());
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 4db3fe1b5cd8c0b2b1d03b4589b0d55822c16107..89ceee76c085cfdf8f1d79c21b0b1e994b335c58 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.307 2004-05-27 06:23:48 geuzaine Exp $
+// $Id: GUI.cpp,v 1.308 2004-05-29 10:11:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1439,27 +1439,26 @@ void GUI::create_option_window()
       gen_butt[1] = new Fl_Check_Button(2 * WB, 2 * WB + 3 * BH, BW, BH, "Show small axes");
       gen_butt[2] = new Fl_Check_Button(2 * WB, 2 * WB + 4 * BH, BW, BH, "Enable fast redraw");
       gen_butt[3] = new Fl_Check_Button(2 * WB, 2 * WB + 5 * BH, BW, BH, "Enable double buffering");
-      gen_butt[4] = new Fl_Check_Button(2 * WB, 2 * WB + 6 * BH, BW, BH, "Use display lists");
-      gen_butt[5] = new Fl_Check_Button(2 * WB, 2 * WB + 7 * BH, BW, BH, "Enable alpha blending");
-      gen_butt[6] = new Fl_Check_Button(2 * WB, 2 * WB + 8 * BH, BW, BH, "Use trackball rotation mode");
-      for(i = 0; i < 7; i++) {
+      gen_butt[4] = new Fl_Check_Button(2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable alpha blending");
+      gen_butt[5] = new Fl_Check_Button(2 * WB, 2 * WB + 7 * BH, BW, BH, "Use trackball rotation mode");
+      for(i = 0; i < 6; i++) {
         gen_butt[i]->type(FL_TOGGLE_BUTTON);
         gen_butt[i]->down_box(TOGGLE_BOX);
         gen_butt[i]->selection_color(TOGGLE_COLOR);
       }
 
-      gen_butt[15] = new Fl_Check_Button(2 * WB, 2 * WB + 9 * BH, BW, BH, "Rotate around pseudo center of gravity");
+      gen_butt[15] = new Fl_Check_Button(2 * WB, 2 * WB + 8 * BH, BW, BH, "Rotate around pseudo center of gravity");
       gen_butt[15]->type(FL_TOGGLE_BUTTON);
       gen_butt[15]->down_box(TOGGLE_BOX);
       gen_butt[15]->selection_color(TOGGLE_COLOR);
       gen_butt[15]->callback(general_options_rotation_center_cb);
 
-      gen_push_butt[0] = new Fl_Button(2 * IW - 2 * WB, 2 * WB + 10 * BH, BB, BH, "Select");
+      gen_push_butt[0] = new Fl_Button(2 * IW - 2 * WB, 2 * WB + 9 * BH, BB, BH, "Select");
       gen_push_butt[0]->callback(general_options_rotation_center_select_cb);
 
-      gen_value[8] = new Fl_Value_Input(2 * WB, 2 * WB + 10 * BH, IW / 3, BH);
-      gen_value[9] = new Fl_Value_Input(2 * WB + IW / 3, 2 * WB + 10 * BH, IW / 3, BH);
-      gen_value[10] = new Fl_Value_Input(2 * WB + 2 * IW / 3, 2 * WB + 10 * BH, IW / 3, BH, "Rotation center");
+      gen_value[8] = new Fl_Value_Input(2 * WB, 2 * WB + 9 * BH, IW / 3, BH);
+      gen_value[9] = new Fl_Value_Input(2 * WB + IW / 3, 2 * WB + 9 * BH, IW / 3, BH);
+      gen_value[10] = new Fl_Value_Input(2 * WB + 2 * IW / 3, 2 * WB + 9 * BH, IW / 3, BH, "Rotation center");
       gen_value[10]->align(FL_ALIGN_RIGHT);
 
       o->end();
diff --git a/Fltk/Makefile b/Fltk/Makefile
index cfd7bd82ddb2a125d19be6c543f7993d8d264d80..8d79ed1cbc4c0857dee2a88e95937eaf812a16e9 100644
--- a/Fltk/Makefile
+++ b/Fltk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.53 2004-05-25 23:16:25 geuzaine Exp $
+# $Id: Makefile,v 1.54 2004-05-29 10:11:11 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -65,8 +65,8 @@ depend:
 # DO NOT DELETE THIS LINE
 Main.o: Main.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Common/Gmsh.h \
-  ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Common/Gmsh.h ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../DataStr/Tools.h ../Common/GmshUI.h ../Common/GmshVersion.h \
   ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
@@ -81,8 +81,8 @@ Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \
   Opengl_Window.h Colorbar_Window.h ../Common/ColorTable.h
 GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Common/Gmsh.h \
-  ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Common/Gmsh.h ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../DataStr/Tools.h ../Common/GmshUI.h ../Numeric/Numeric.h \
   ../Common/GmshVersion.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
@@ -95,29 +95,30 @@ Callbacks.o: Callbacks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h ../Geo/ExtractContour.h \
-  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Timer.h ../Graphics/CreateFile.h ../Parser/OpenFile.h \
-  ../Common/CommandLine.h ../Common/Context.h ../Common/Options.h GUI.h \
-  Opengl_Window.h Colorbar_Window.h Callbacks.h ../Plugin/Plugin.h \
-  ../Common/Visibility.h ../Geo/MinMax.h Solvers.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Geo/ExtractContour.h ../Graphics/Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/Timer.h ../Graphics/CreateFile.h \
+  ../Parser/OpenFile.h ../Common/CommandLine.h ../Common/Context.h \
+  ../Common/Options.h GUI.h Opengl_Window.h Colorbar_Window.h Callbacks.h \
+  ../Plugin/Plugin.h ../Common/Visibility.h ../Geo/MinMax.h Solvers.h
 Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h GUI.h Opengl_Window.h Colorbar_Window.h \
-  ../Graphics/gl2ps.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h GUI.h \
+  Opengl_Window.h Colorbar_Window.h ../Graphics/gl2ps.h
 Opengl_Window.o: Opengl_Window.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h \
   ../Common/GmshUI.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h GUI.h Opengl_Window.h Colorbar_Window.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Graphics/Draw.h ../Common/Views.h ../Common/ColorTable.h GUI.h \
+  Opengl_Window.h Colorbar_Window.h
 Colorbar_Window.o: Colorbar_Window.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
@@ -130,6 +131,6 @@ Solvers.o: Solvers.cpp ../Common/Gmsh.h ../Common/Message.h \
   GmshServer.h ../Parser/OpenFile.h Solvers.h ../Common/GmshUI.h GUI.h \
   Opengl_Window.h Colorbar_Window.h ../Common/ColorTable.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Graphics/Draw.h ../Common/Views.h \
-  ../Common/Context.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Graphics/Draw.h ../Common/Views.h ../Common/Context.h
diff --git a/Geo/Makefile b/Geo/Makefile
index d8dd984abcfd0275efb5ee75e4462780c020606f..6493635d17cb65aeacd2195ae81f2327c007aef1 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.50 2004-05-25 23:16:26 geuzaine Exp $
+# $Id: Makefile,v 1.51 2004-05-29 10:11:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -62,9 +62,9 @@ CAD.o: CAD.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Mesh/Interpolation.h ../Mesh/Create.h CAD.h ../Common/Visibility.h \
-  ../Common/Context.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Interpolation.h \
+  ../Mesh/Create.h CAD.h ../Common/Visibility.h ../Common/Context.h
 MinMax.o: MinMax.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h \
@@ -73,37 +73,39 @@ ExtrudeParams.o: ExtrudeParams.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h CAD.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h
 Geo.o: Geo.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Parser/Parser.h ../Common/Context.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Parser/Parser.h \
+  ../Common/Context.h
 GeoUtils.o: GeoUtils.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h CAD.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h
 StepGeomDatabase.o: StepGeomDatabase.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Geo.h GeoUtils.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Mesh/Nurbs.h CAD.h StepGeomDatabase.h ../Mesh/Create.h \
-  ../Common/Context.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Nurbs.h CAD.h \
+  StepGeomDatabase.h ../Mesh/Create.h ../Common/Context.h
 ExtractContour.o: ExtractContour.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h GeoUtils.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h CAD.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h CAD.h
 Print_Geo.o: Print_Geo.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h CAD.h ../Common/Context.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h CAD.h \
+  ../Common/Context.h
diff --git a/Graphics/Draw.h b/Graphics/Draw.h
index 1ddd6237a412ef44405512b536a521874bf4fe34..57bcc2b60fb414b4f38c5abcc742d240a7e8d3ab 100644
--- a/Graphics/Draw.h
+++ b/Graphics/Draw.h
@@ -42,9 +42,9 @@ void set_r(int i, double val);
 void set_t(int i, double val);
 void set_s(int i, double val);
 
-void PaletteContinuous(Post_View * View, double min, double max, double val);
-void PaletteContinuousLinear(Post_View * v, double min, double max, double val);
-void PaletteDiscrete(Post_View * View, int nbi, int i);
+unsigned int PaletteContinuous(Post_View * View, double min, double max, double val);
+unsigned int PaletteContinuousLinear(Post_View * v, double min, double max, double val);
+unsigned int PaletteDiscrete(Post_View * View, int nbi, int i);
 
 char SelectEntity(int type, Vertex **v, Curve **c, Surface **s);
 void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent);
@@ -72,10 +72,6 @@ void Draw_Point(int type, double size, double *x, double *y, double *z,
 		double Raise[3][8], int light);
 void Draw_Line(int type, double width, double *x, double *y, double *z,
 	       double Raise[3][8], int light);
-void Draw_Triangle(double *x, double *y, double *z,double *n,
-		   double Raise[3][8], int light, bool polygon_offset);
-void Draw_Quadrangle(double *x, double *y, double *z, double *n,
-		     double Raise[3][8], int light, bool polygon_offset);
 void Draw_Vector(int Type, int Fill,
 		 double relHeadRadius, double relStemLength, double relStemRadius,
 		 double x, double y, double z, double dx, double dy, double dz,
diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index a91a6c5d7cf124e2b48ae49e5059b1856b858c93..abfb0179fa6d41b11b6bf587b6b46b4f26c17ea7 100644
--- a/Graphics/Entity.cpp
+++ b/Graphics/Entity.cpp
@@ -1,4 +1,4 @@
-// $Id: Entity.cpp,v 1.40 2004-05-28 21:06:11 geuzaine Exp $
+// $Id: Entity.cpp,v 1.41 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -125,75 +125,6 @@ void Draw_Line(int type, double width, double *x, double *y, double *z,
   }
 }
 
-void Draw_Triangle(double *x, double *y, double *z, double *n,
-                   double Raise[3][8], int light, bool polygon_offset)
-{
-  double x1x0, y1y0, z1z0, x2x0, y2y0, z2z0, nn[3];
-
-  if(light) glEnable(GL_LIGHTING);
-  if(polygon_offset) glEnable(GL_POLYGON_OFFSET_FILL);
-
-  glBegin(GL_TRIANGLES);
-  if(light) {
-    if(!n) {
-      x1x0 = (x[1] + Raise[0][1]) - (x[0] + Raise[0][0]);
-      y1y0 = (y[1] + Raise[1][1]) - (y[0] + Raise[1][0]);
-      z1z0 = (z[1] + Raise[2][1]) - (z[0] + Raise[2][0]);
-      x2x0 = (x[2] + Raise[0][2]) - (x[0] + Raise[0][0]);
-      y2y0 = (y[2] + Raise[1][2]) - (y[0] + Raise[1][0]);
-      z2z0 = (z[2] + Raise[2][2]) - (z[0] + Raise[2][0]);
-      nn[0] = y1y0 * z2z0 - z1z0 * y2y0;
-      nn[1] = z1z0 * x2x0 - x1x0 * z2z0;
-      nn[2] = x1x0 * y2y0 - y1y0 * x2x0;
-      norme(nn);
-      glNormal3dv(nn);
-    }
-    else
-      glNormal3dv(&n[0]);
-  }
-
-  glVertex3d(x[0] + Raise[0][0], y[0] + Raise[1][0], z[0] + Raise[2][0]);
-
-  if(light && n)
-    glNormal3dv(&n[3]);
-
-  glVertex3d(x[1] + Raise[0][1], y[1] + Raise[1][1], z[1] + Raise[2][1]);
-
-  if(light && n)
-    glNormal3dv(&n[6]);
-
-  glVertex3d(x[2] + Raise[0][2], y[2] + Raise[1][2], z[2] + Raise[2][2]);
-  glEnd();
-
-  glDisable(GL_POLYGON_OFFSET_FILL);
-  glDisable(GL_LIGHTING);
-}
-
-void Draw_Quadrangle(double *x, double *y, double *z, double *n,
-                     double Raise[3][8], int light, bool polygon_offset)
-{
-  double x2[3] = { x[2], x[3], x[0] };
-  double y2[3] = { y[2], y[3], y[0] };
-  double z2[3] = { z[2], z[3], z[0] };
-
-  Draw_Triangle(x, y, z, n, Raise, light, polygon_offset);
-  if(n) {
-    double n2[9];
-    n2[0] = n[6];
-    n2[1] = n[7];
-    n2[2] = n[8];
-    n2[3] = n[9];
-    n2[4] = n[10];
-    n2[5] = n[11];
-    n2[6] = n[0];
-    n2[7] = n[1];
-    n2[8] = n[2];
-    Draw_Triangle(x2, y2, z2, n2, Raise, light, polygon_offset);
-  }
-  else
-    Draw_Triangle(x2, y2, z2, n, Raise, light, polygon_offset);
-}
-
 void Draw_SimpleVector(int arrow, int fill,
 		       double relHeadRadius, double relStemLength, double relStemRadius,
 		       double x, double y, double z,
diff --git a/Graphics/Iso.cpp b/Graphics/Iso.cpp
index 8bde4007cb32df57d8f1998c34a5279105f4a479..e69d3e51c1a29ee4bf4daf73b5665149dbbe139e 100644
--- a/Graphics/Iso.cpp
+++ b/Graphics/Iso.cpp
@@ -1,4 +1,4 @@
-// $Id: Iso.cpp,v 1.23 2004-05-08 00:19:47 geuzaine Exp $
+// $Id: Iso.cpp,v 1.24 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -48,7 +48,6 @@ void CutTriangle1D(double *X, double *Y, double *Z, double *Val,
     InterpolateIso(X, Y, Z, Val, V, 1, 2, &Xp[*nb], &Yp[*nb], &Zp[*nb]);
     (*nb)++;
   }
-
 }
 
 // Contour computation for triangles
@@ -281,7 +280,6 @@ void CutLine1D(double *X, double *Y, double *Z, double *Val,
     Vp2[1] = V2;
     InterpolateIso(X, Y, Z, Val, V2, io[0], io[1], &Xp2[1], &Yp2[1], &Zp2[1]);
   }
-
 }
 
 // compute the gradient of a linear interpolation in a tetrahedron
@@ -328,11 +326,6 @@ void EnhanceSimplexPolygon(Post_View * View, int nb,    // nb of points in polyg
      v = unknown field we wanna draw
    */
 
-  if(!View->Light) {
-    norms = NULL;       // we don't need to compute these
-    return;
-  }
-
   double v1[3] = { Xp[2] - Xp[0], Yp[2] - Yp[0], Zp[2] - Zp[0] };
   double v2[3] = { Xp[1] - Xp[0], Yp[1] - Yp[0], Zp[1] - Zp[0] };
   double gr[3];
@@ -372,11 +365,8 @@ void EnhanceSimplexPolygon(Post_View * View, int nb,    // nb of points in polyg
         norms[3 * i] = n[0];
         norms[3 * i + 1] = n[1];
         norms[3 * i + 2] = n[2];
-        if(!View->
-           get_normal(Xp[i], Yp[i], Zp[i], norms[3 * i], norms[3 * i + 1],
-                      norms[3 * i + 2])) {
-          //Msg(WARNING, "Oups, did not find smoothed normal");
-        }
+        View->get_normal
+	  (Xp[i], Yp[i], Zp[i], norms[3 * i], norms[3 * i + 1], norms[3 * i + 2]);
       }
     }
   }
@@ -387,13 +377,11 @@ void EnhanceSimplexPolygon(Post_View * View, int nb,    // nb of points in polyg
       norms[3 * i + 2] = n[2];
     }
   }
-
 }
 
-void IsoSimplex(Post_View * View,
-                int preproNormals,
+void IsoSimplex(Post_View * View, int preproNormals,
                 double *X, double *Y, double *Z, double *Val,
-                double V)
+                double V, unsigned int color)
 {
   int nb;
   double Xp[6], Yp[6], Zp[6], PVals[6];
@@ -434,13 +422,42 @@ void IsoSimplex(Post_View * View,
   if(preproNormals)
     return;
 
-  double Raise[3][8];
-  for(int i = 0; i < 3; i++)
-    for(int k = 0; k < nb; k++)
-      Raise[i][k] = View->Raise[i] * V;
-
-  if(nb == 3)
-    Draw_Triangle(Xp, Yp, Zp, norms, Raise, View->Light, false);
-  else if(nb == 4)
-    Draw_Quadrangle(Xp, Yp, Zp, norms, Raise, View->Light, false);
+  if(View->FillVertexArray){
+    for(int i = 2; i < nb; i++){
+      View->VertexArray->add(Xp[0] + View->Raise[0] * V,
+			     Yp[0] + View->Raise[1] * V,
+			     Zp[0] + View->Raise[2] * V,
+			     norms[0], norms[1], norms[2], color);
+      View->VertexArray->add(Xp[i-1] + View->Raise[0] * V,
+			     Yp[i-1] + View->Raise[1] * V,
+			     Zp[i-1] + View->Raise[2] * V,
+			     norms[3*(i-1)], norms[3*(i-1)+1], norms[3*(i-1)+2], color);
+      View->VertexArray->add(Xp[i] + View->Raise[0] * V,
+			     Yp[i] + View->Raise[1] * V,
+			     Zp[i] + View->Raise[2] * V,
+			     norms[3*i], norms[3*i+1], norms[3*i+2], color);
+      View->VertexArray->num_triangles++;
+    }
+  }
+  else{
+    if(View->Light) glEnable(GL_LIGHTING);
+    glColor4ubv((GLubyte *) & color);
+    glBegin(GL_TRIANGLES);
+    for(int i = 2; i < nb; i++){
+      if(View->Light) glNormal3dv(&norms[0]);
+      glVertex3d(Xp[0] + View->Raise[0] * V, 
+		 Yp[0] + View->Raise[1] * V, 
+		 Zp[0] + View->Raise[2] * V);
+      if(View->Light) glNormal3dv(&norms[3*(i-1)]);
+      glVertex3d(Xp[i-1] + View->Raise[0] * V, 
+		 Yp[i-1] + View->Raise[1] * V, 
+		 Zp[i-1] + View->Raise[2] * V);
+      if(View->Light) glNormal3dv(&norms[3*i]);
+      glVertex3d(Xp[i] + View->Raise[0] * V, 
+		 Yp[i] + View->Raise[1] * V, 
+		 Zp[i] + View->Raise[2] * V);
+    }
+    glEnd();
+    glDisable(GL_LIGHTING);
+  }
 }
diff --git a/Graphics/Iso.h b/Graphics/Iso.h
index f661d7266a2dab77af225548f4632f09c3753f59..4b39adda5acf6d320039d24c31b1d22eba52e065 100644
--- a/Graphics/Iso.h
+++ b/Graphics/Iso.h
@@ -22,23 +22,22 @@
 
 #include "Views.h"
 
-void CutTriangle1D (double *X, double *Y, double *Z, double *Val,
-                    double V, double *Xp, double *Yp, double *Zp, int *nb);
+void CutTriangle1D(double *X, double *Y, double *Z, double *Val,
+		   double V, double *Xp, double *Yp, double *Zp, int *nb);
 
-void CutTriangle2D (double *X, double *Y, double *Z, double *Val,
-                    double V1, double V2, double *Xp, double *Yp, double *Zp, 
-		    int *nb, double *value);
+void CutTriangle2D(double *X, double *Y, double *Z, double *Val,
+		   double V1, double V2, double *Xp, double *Yp, double *Zp, 
+		   int *nb, double *value);
 
-void CutLine0D (double *X, double *Y, double *Z, double *Val,
-                double V, double *Xp, double *Yp, double *Zp, int *nb);
+void CutLine0D(double *X, double *Y, double *Z, double *Val,
+	       double V, double *Xp, double *Yp, double *Zp, int *nb);
 
-void CutLine1D (double *X, double *Y, double *Z, double *Val,
-                double V1, double V2, double *Xp, double *Yp, double *Zp,
-		int *nb, double *value);
+void CutLine1D(double *X, double *Y, double *Z, double *Val,
+	       double V1, double V2, double *Xp, double *Yp, double *Zp,
+	       int *nb, double *value);
 
-void IsoSimplex (Post_View *View, 
-		 int preproNormals,
-		 double *X, double *Y, double *Z, double *Val,
-                 double V);
+void IsoSimplex(Post_View *View, int preproNormals, 
+		double *X, double *Y, double *Z, double *Val, double V,
+		unsigned int color);
   
 #endif
diff --git a/Graphics/Makefile b/Graphics/Makefile
index 2dab2cbc3aacf1ded6c07f05e69afc8d927f51a0..38f1072e62cc7d7d2e469382278e91b3469c544b 100644
--- a/Graphics/Makefile
+++ b/Graphics/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.58 2004-05-25 23:16:26 geuzaine Exp $
+# $Id: Makefile,v 1.59 2004-05-29 10:11:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -73,86 +73,91 @@ Draw.o: Draw.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h ../Geo/MinMax.h ../Numeric/Numeric.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  ../Geo/MinMax.h ../Numeric/Numeric.h
 Mesh.o: Mesh.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Geo/Geo.h ../Geo/CAD.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h ../Geo/MinMax.h gl2ps.h ../Numeric/Numeric.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  ../Geo/MinMax.h gl2ps.h ../Numeric/Numeric.h
 Geom.o: Geom.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Geo/Geo.h ../Geo/CAD.h \
   ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
   ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Utils.h Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
-  ../Mesh/Interpolation.h gl2ps.h
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Mesh/Utils.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
+  ../Common/Context.h ../Mesh/Interpolation.h gl2ps.h
 Post.o: Post.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Geo/Geo.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Common/Context.h gl2ps.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h gl2ps.h
 PostElement.o: PostElement.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Geo/Geo.h \
   ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
   ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h Iso.h ../Common/Context.h ../Numeric/Numeric.h
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h Iso.h ../Common/Context.h \
+  ../Numeric/Numeric.h
 Iso.o: Iso.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
-  ../Numeric/Numeric.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/Context.h ../Numeric/Numeric.h
 Entity.o: Entity.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h
 ReadImg.o: ReadImg.cpp ReadImg.h ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
-  ../Common/Views.h ../Common/ColorTable.h
+  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h
 Scale.o: Scale.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
   ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
-  ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h gl2ps.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
+  gl2ps.h
 Graph2D.o: Graph2D.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h \
   ../Common/Context.h ../Numeric/Numeric.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
-  gl2ps.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h \
+  ../Common/Views.h ../Common/ColorTable.h gl2ps.h
 Axes.o: Axes.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Common/GmshUI.h ../Numeric/Numeric.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
   ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  Draw.h ../Common/Views.h ../Common/ColorTable.h ../Common/Context.h \
-  gl2ps.h
+  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Common/VertexArray.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h Draw.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Common/Context.h gl2ps.h
 CreateFile.o: CreateFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Common/GmshUI.h ../Mesh/Mesh.h \
   ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
-  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
-  ../Mesh/Matrix.h ../Parser/OpenFile.h Draw.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Common/Context.h ../Common/Options.h gl2ps.h \
-  gl2gif.h gl2jpeg.h gl2png.h gl2ppm.h gl2yuv.h
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Parser/OpenFile.h Draw.h ../Common/Views.h ../Common/ColorTable.h \
+  ../Common/Context.h ../Common/Options.h gl2ps.h gl2gif.h gl2jpeg.h \
+  gl2png.h gl2ppm.h gl2yuv.h
 gl2ps.o: gl2ps.cpp gl2ps.h
 gl2gif.o: gl2gif.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
diff --git a/Graphics/Mesh.cpp b/Graphics/Mesh.cpp
index e09027d067ed017929d461e073a6159fd0c9c7ff..3aa0f8b145606a0f4292b8c6ff830420ae721e74 100644
--- a/Graphics/Mesh.cpp
+++ b/Graphics/Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Mesh.cpp,v 1.88 2004-05-28 21:06:11 geuzaine Exp $
+// $Id: Mesh.cpp,v 1.89 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -232,7 +232,7 @@ void Draw_Mesh_Surface(void *a, void *b)
   if(CTX.mesh.vertex_arrays && Tree_Nbr(s->Simplexes) && !CTX.threads_lock){
     CTX.threads_lock = 1;
     if(CTX.mesh.changed){
-      printf("generate vertex array\n");
+      Msg(DEBUG, "regenerate mesh vertex array");
       if(s->vertexArray) delete s->vertexArray;
       s->vertexArray = new triangleVertexArray(Tree_Nbr(s->Simplexes));
       theVertexArray = s->vertexArray;
@@ -536,20 +536,23 @@ void Draw_Mesh_Triangle(void *a, void *b)
 		   X[2], Y[2], Z[2], n);
 
   if(fillTheVertexArray && !s->VSUP){
-    int iv = theVertexArray->num_triangles * 9;
-    int in = theVertexArray->num_triangles * 9;
-    int ic = theVertexArray->num_triangles * 12;
     for(int i = 0; i < 3; i++) {
-      theVertexArray->vertices[iv++] = X[i];
-      theVertexArray->vertices[iv++] = Y[i];
-      theVertexArray->vertices[iv++] = Z[i];
-      theVertexArray->normals[in++] = n[0];
-      theVertexArray->normals[in++] = n[1];
-      theVertexArray->normals[in++] = n[2];
-      theVertexArray->colors[ic++] = UNPACK_RED(col);
-      theVertexArray->colors[ic++] = UNPACK_GREEN(col);
-      theVertexArray->colors[ic++] = UNPACK_BLUE(col);
-      theVertexArray->colors[ic++] = UNPACK_ALPHA(col);
+      float x = X[i], y = Y[i], z = Z[i];
+      float n0 = n[0], n1 = n[1], n2 = n[2];
+      unsigned char r = UNPACK_RED(col);
+      unsigned char g = UNPACK_GREEN(col);
+      unsigned char b = UNPACK_BLUE(col);
+      unsigned char a = UNPACK_ALPHA(col);
+      List_Add(theVertexArray->vertices, &x);
+      List_Add(theVertexArray->vertices, &y);
+      List_Add(theVertexArray->vertices, &z);
+      List_Add(theVertexArray->normals, &n0);
+      List_Add(theVertexArray->normals, &n1);
+      List_Add(theVertexArray->normals, &n2);
+      List_Add(theVertexArray->colors, &r);
+      List_Add(theVertexArray->colors, &g);
+      List_Add(theVertexArray->colors, &b);
+      List_Add(theVertexArray->colors, &a);
     }
     theVertexArray->num_triangles++;
   }    
@@ -630,9 +633,9 @@ void Draw_Mesh_Triangle_Array(triangleVertexArray *va)
   if(!va->num_triangles)
     return;
 
-  glVertexPointer(3, GL_FLOAT, 0, va->vertices);
-  glNormalPointer(GL_FLOAT, 0, va->normals);
-  glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->colors);
+  glVertexPointer(3, GL_FLOAT, 0, va->vertices->array);
+  glNormalPointer(GL_FLOAT, 0, va->normals->array);
+  glColorPointer(4, GL_UNSIGNED_BYTE, 0, va->colors->array);
 
   glEnableClientState(GL_VERTEX_ARRAY);
   glEnableClientState(GL_COLOR_ARRAY);
diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp
index 11536af24bf053f23fe9072738a6c1d9fd10af9e..6eacb485c505d19757b2f60c2fd299155f864342 100644
--- a/Graphics/Post.cpp
+++ b/Graphics/Post.cpp
@@ -1,4 +1,4 @@
-// $Id: Post.cpp,v 1.60 2004-04-27 00:11:55 geuzaine Exp $
+// $Id: Post.cpp,v 1.61 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -101,19 +101,21 @@ int GiveIndexFromValue_DoubleLog(double ValMin, double ValMax, int NbIso,
 
 // Color Palette
 
-void PaletteContinuous(Post_View * v, double min, double max, double val)
+unsigned int PaletteContinuous(Post_View * v, double min, double max, double val)
 {       /* val in [min,max] */
   int index = v->GIFV(min, max, v->CT.size, val);
   glColor4ubv((GLubyte *) & v->CT.table[index]);
+  return v->CT.table[index];
 }
 
-void PaletteContinuousLinear(Post_View * v, double min, double max, double val)
+unsigned int PaletteContinuousLinear(Post_View * v, double min, double max, double val)
 {       /* val in [min,max] */
   int index = GiveIndexFromValue_Lin(min, max, v->CT.size, val);
   glColor4ubv((GLubyte *) & v->CT.table[index]);
+  return v->CT.table[index];
 }
 
-void PaletteDiscrete(Post_View * v, int nbi, int i)
+unsigned int PaletteDiscrete(Post_View * v, int nbi, int i)
 {       /* i in [0,nbi-1] */
   int index;
 
@@ -121,6 +123,7 @@ void PaletteDiscrete(Post_View * v, int nbi, int i)
     v->CT.size / 2 : (int)(i / (double)(nbi - 1) * (v->CT.size - 1) + 0.5);
 
   glColor4ubv((GLubyte *) & v->CT.table[index]);
+  return v->CT.table[index];
 }
 
 // Compute node coordinates taking Offset and Explode into account
@@ -266,7 +269,7 @@ void Draw_ScalarList(Post_View * v, double ValMin, double ValMax,
 }
 
 void Draw_VectorList(Post_View * v, double ValMin, double ValMax,
-                     List_T * list, int nbelm, int nbnod,
+                     List_T * list, int nbelm, int nbnod, 
                      void (*draw) (Post_View *, double, double,
                                    double *, double *, double *, double *))
 {
@@ -287,7 +290,7 @@ void Draw_VectorList(Post_View * v, double ValMin, double ValMax,
 }
 
 void Draw_TensorList(Post_View * v, double ValMin, double ValMax,
-                     List_T * list, int nbelm, int nbnod,
+                     List_T * list, int nbelm, int nbnod, 
                      void (*draw) (Post_View *, double, double,
                                    double *, double *, double *, double *))
 {
@@ -367,195 +370,198 @@ void Draw_Post(void)
 
     if(v->Visible && !v->Dirty) {
 
-      // Sort the data % eye for transparency. Hybrid views (e.g. tri
-      // + qua) or multiple views will be sorted incorrectly... You
-      // can use Plugin(DecomposeInSimplex) and/or View->Combine for
-      // this.
-
-      if(CTX.alpha && ColorTable_IsAlpha(&v->CT) && 
-	 (changedEye() || v->Changed)) {
-        Msg(DEBUG, "Sorting view %d", v->Num);
-
-        if(v->DrawScalars) {
-
-          if(v->IntervalsType != DRAW_POST_ISO) {
-
-            if(v->NbST && v->DrawTriangles) {
-              nb = List_Nbr(v->ST) / v->NbST;
-              qsort(v->ST->array, v->NbST, nb * sizeof(double), compareEye3Nodes);
-              v->Changed = 1;
-            }
-            if(v->NbSQ && v->DrawQuadrangles) {
-              nb = List_Nbr(v->SQ) / v->NbSQ;
-              qsort(v->SQ->array, v->NbSQ, nb * sizeof(double), compareEye4Nodes);
-              v->Changed = 1;
-            }
-
-          }
-
-          // The following is of course not rigorous: we should store
-          // the triangles generated during the iso computation, and
-          // sort these... But this is better than doing nothing. If
-          // you want a rigorous sorting of the iso-surfaces, just use
-          // Plugin(CutMap).
-
-          if(v->NbSS && v->DrawTetrahedra) {
-            nb = List_Nbr(v->SS) / v->NbSS;
-            qsort(v->SS->array, v->NbSS, nb * sizeof(double), compareEye4Nodes);
-            v->Changed = 1;
-          }
-          if(v->NbSH && v->DrawHexahedra) {
-            nb = List_Nbr(v->SH) / v->NbSH;
-            qsort(v->SH->array, v->NbSH, nb * sizeof(double), compareEye8Nodes);
-            v->Changed = 1;
-          }
-          if(v->NbSI && v->DrawPrisms) {
-            nb = List_Nbr(v->SI) / v->NbSI;
-            qsort(v->SI->array, v->NbSI, nb * sizeof(double), compareEye6Nodes);
-            v->Changed = 1;
-          }
-          if(v->NbSY && v->DrawPyramids) {
-            nb = List_Nbr(v->SY) / v->NbSY;
-            qsort(v->SY->array, v->NbSY, nb * sizeof(double), compareEye5Nodes);
-            v->Changed = 1;
-          }
-
-        }
-
+      glPointSize(v->PointSize);
+      gl2psPointSize(v->PointSize * CTX.print.eps_point_size_factor);
+      
+      glLineWidth(v->LineWidth);
+      gl2psLineWidth(v->LineWidth * CTX.print.eps_line_width_factor);
+      
+      switch (v->RangeType) {
+      case DRAW_POST_RANGE_DEFAULT:
+	ValMin = v->Min;
+	ValMax = v->Max;
+	break;
+      case DRAW_POST_RANGE_CUSTOM:
+	ValMin = v->CustomMin;
+	ValMax = v->CustomMax;
+	break;
+      case DRAW_POST_RANGE_PER_STEP:
+	ValMin = v->TimeStepMin[v->TimeStep];
+	ValMax = v->TimeStepMax[v->TimeStep];
+	break;
+      }
+      
+      switch (v->ScaleType) {
+      case DRAW_POST_LINEAR:
+	v->GIFV = GiveIndexFromValue_Lin;
+	v->GVFI = GiveValueFromIndex_Lin;
+	break;
+      case DRAW_POST_LOGARITHMIC:
+	v->GIFV = GiveIndexFromValue_Log;
+	v->GVFI = GiveValueFromIndex_Log;
+	break;
+      case DRAW_POST_DOUBLELOGARITHMIC:
+	v->GIFV = GiveIndexFromValue_DoubleLog;
+	v->GVFI = GiveValueFromIndex_DoubleLog;
+	break;
       }
 
-      if(CTX.post.display_lists && !v->Changed && v->DisplayListNum > 0) {
-
-        Msg(DEBUG, "Call display List %d", v->DisplayListNum);
-        glCallList(v->DisplayListNum);
+      // if we don't use vertex arrays, do a simple sort of
+      // transparent views (hybrid views will be sorted incorrectly;
+      // use Plugin(DecomposeInSimplex) and View->Combine to do remedy
+      // this limitation)
+      if(!CTX.post.vertex_arrays && CTX.alpha && ColorTable_IsAlpha(&v->CT) && 
+	 v->DrawScalars && (changedEye() || v->Changed)) {
+	Msg(DEBUG, "Sorting for transparency (NO vertex array)");
+	if(v->IntervalsType != DRAW_POST_ISO) {
+	  if(v->NbST && v->DrawTriangles) {
+	    nb = List_Nbr(v->ST) / v->NbST;
+	    qsort(v->ST->array, v->NbST, nb * sizeof(double), compareEye3Nodes);
+	  }
+	  if(v->NbSQ && v->DrawQuadrangles) {
+	    nb = List_Nbr(v->SQ) / v->NbSQ;
+	    qsort(v->SQ->array, v->NbSQ, nb * sizeof(double), compareEye4Nodes);
+	  }
+	}
+	if(v->NbSS && v->DrawTetrahedra) {
+	  nb = List_Nbr(v->SS) / v->NbSS;
+	  qsort(v->SS->array, v->NbSS, nb * sizeof(double), compareEye4Nodes);
+	}
+	if(v->NbSH && v->DrawHexahedra) {
+	  nb = List_Nbr(v->SH) / v->NbSH;
+	  qsort(v->SH->array, v->NbSH, nb * sizeof(double), compareEye8Nodes);
+	}
+	if(v->NbSI && v->DrawPrisms) {
+	  nb = List_Nbr(v->SI) / v->NbSI;
+	  qsort(v->SI->array, v->NbSI, nb * sizeof(double), compareEye6Nodes);
+	}
+	if(v->NbSY && v->DrawPyramids) {
+	  nb = List_Nbr(v->SY) / v->NbSY;
+	  qsort(v->SY->array, v->NbSY, nb * sizeof(double), compareEye5Nodes);
+	}
+      }
+      
+      if(v->DrawPoints) {
+	if(v->Type == DRAW_POST_3D)
+	  Draw_ScalarList(v, ValMin, ValMax, v->SP, v->NbSP, 1, 0, Draw_ScalarPoint);
+	Draw_VectorList(v, ValMin, ValMax, v->VP, v->NbVP, 1, Draw_VectorPoint);
+	Draw_TensorList(v, ValMin, ValMax, v->TP, v->NbTP, 1, Draw_TensorPoint);
+      }
+      if(v->DrawLines) {
+	Draw_ScalarList(v, ValMin, ValMax, v->SL, v->NbSL, 2, 0, Draw_ScalarLine);
+	Draw_VectorList(v, ValMin, ValMax, v->VL, v->NbVL, 2, Draw_VectorLine);
+	Draw_TensorList(v, ValMin, ValMax, v->TL, v->NbTL, 2, Draw_TensorLine);
+      }
 
+      for(int p = 0; p < 2; p++){ // two-passes for vertex arrays
+	int skip_2d = 0, skip_3d = 0;
+	if(p == 0){
+	  if(CTX.post.vertex_arrays && !CTX.threads_lock){
+	    CTX.threads_lock = 1;
+	    if(v->Changed){
+	      Msg(DEBUG, "regenerate View[%d] vertex array", v->Num);
+	      if(v->VertexArray) delete v->VertexArray;
+	      v->VertexArray = new triangleVertexArray(10000);
+	      v->FillVertexArray = 1;
+	    }
+	    else
+	      goto pass2;
+	  }
+	  else
+	    goto pass2;
+	}
+	if(p == 1){
+	  if(CTX.post.vertex_arrays && v->VertexArray){
+	    v->UseVertexArray = 1;
+	    if(v->Boundary < 1 && !v->ShowElement &&
+	       v->IntervalsType != DRAW_POST_NUMERIC && v->IntervalsType != DRAW_POST_ISO)
+	      skip_2d = 1;
+	    if(v->Boundary < 2 && !v->ShowElement &&
+	       v->IntervalsType != DRAW_POST_NUMERIC)
+	      skip_3d = 1;
+	  }
+	}
+
+	if(v->DrawTriangles) {
+	  if(!skip_2d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->ST, v->NbST, 3, 1, Draw_ScalarTriangle);
+	  Draw_VectorList(v, ValMin, ValMax, v->VT, v->NbVT, 3, Draw_VectorTriangle);
+	  Draw_TensorList(v, ValMin, ValMax, v->TT, v->NbTT, 3, Draw_TensorTriangle);
+	}
+	if(v->DrawQuadrangles) {
+	  if(!skip_2d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->SQ, v->NbSQ, 4, 1, Draw_ScalarQuadrangle);
+	  Draw_VectorList(v, ValMin, ValMax, v->VQ, v->NbVQ, 4, Draw_VectorQuadrangle);
+	  Draw_TensorList(v, ValMin, ValMax, v->TQ, v->NbTQ, 4, Draw_TensorQuadrangle);
+	}
+	if(v->DrawTetrahedra) {
+	  if(!skip_3d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->SS, v->NbSS, 4, 1, Draw_ScalarTetrahedron);
+	  Draw_VectorList(v, ValMin, ValMax, v->VS, v->NbVS, 4, Draw_VectorTetrahedron);
+	  Draw_TensorList(v, ValMin, ValMax, v->TS, v->NbTS, 4, Draw_TensorTetrahedron);
+	}
+	if(v->DrawHexahedra) {
+	  if(!skip_3d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->SH, v->NbSH, 8, 1, Draw_ScalarHexahedron);
+	  Draw_VectorList(v, ValMin, ValMax, v->VH, v->NbVH, 8, Draw_VectorHexahedron);
+	  Draw_TensorList(v, ValMin, ValMax, v->TH, v->NbTH, 8, Draw_TensorHexahedron);
+	}
+	if(v->DrawPrisms) {
+	  if(!skip_3d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->SI, v->NbSI, 6, 1, Draw_ScalarPrism);
+	  Draw_VectorList(v, ValMin, ValMax, v->VI, v->NbVI, 6, Draw_VectorPrism);
+	  Draw_TensorList(v, ValMin, ValMax, v->TI, v->NbTI, 6, Draw_TensorPrism);
+	}
+	if(v->DrawPyramids) {
+	  if(!skip_3d)
+	    Draw_ScalarList(v, ValMin, ValMax, v->SY, v->NbSY, 5, 1, Draw_ScalarPyramid);
+	  Draw_VectorList(v, ValMin, ValMax, v->VY, v->NbVY, 5, Draw_VectorPyramid);
+	  Draw_TensorList(v, ValMin, ValMax, v->TY, v->NbTY, 5, Draw_TensorPyramid);
+	}
+
+      pass2:
+	v->FillVertexArray = 0;
+	v->UseVertexArray = 0;
+	CTX.threads_lock = 0;
       }
-      else {
-
-        if(CTX.post.display_lists) {
-          if(v->DisplayListNum > 0) {
-            Msg(DEBUG, "Delete display List %d", v->DisplayListNum);
-            glDeleteLists(v->DisplayListNum, 1);
-          }
-          else {
-            v->DisplayListNum = glGenLists(1);
-            Msg(DEBUG, "Gen display list -> %d", v->DisplayListNum);
-          }
-
-          if(v->DisplayListNum > 0) {
-            Msg(DEBUG, "New display List %d", v->DisplayListNum);
-            glNewList(v->DisplayListNum, GL_COMPILE_AND_EXECUTE);
-          }
-          else
-            Msg(GERROR, "Unable to create display list");
-        }
-
-        glPointSize(v->PointSize);
-        gl2psPointSize(v->PointSize * CTX.print.eps_point_size_factor);
-
-        glLineWidth(v->LineWidth);
-        gl2psLineWidth(v->LineWidth * CTX.print.eps_line_width_factor);
-
-        switch (v->RangeType) {
-        case DRAW_POST_RANGE_DEFAULT:
-          ValMin = v->Min;
-          ValMax = v->Max;
-          break;
-        case DRAW_POST_RANGE_CUSTOM:
-          ValMin = v->CustomMin;
-          ValMax = v->CustomMax;
-          break;
-        case DRAW_POST_RANGE_PER_STEP:
-          ValMin = v->TimeStepMin[v->TimeStep];
-          ValMax = v->TimeStepMax[v->TimeStep];
-          break;
-        }
-
-        switch (v->ScaleType) {
-        case DRAW_POST_LINEAR:
-          v->GIFV = GiveIndexFromValue_Lin;
-          v->GVFI = GiveValueFromIndex_Lin;
-          break;
-        case DRAW_POST_LOGARITHMIC:
-          v->GIFV = GiveIndexFromValue_Log;
-          v->GVFI = GiveValueFromIndex_Log;
-          break;
-        case DRAW_POST_DOUBLELOGARITHMIC:
-          v->GIFV = GiveIndexFromValue_DoubleLog;
-          v->GVFI = GiveValueFromIndex_DoubleLog;
-          break;
-        }
-
-        // Points
-        if(v->DrawPoints) {
-          if(v->Type == DRAW_POST_3D)
-            Draw_ScalarList(v, ValMin, ValMax, v->SP, v->NbSP, 1, 0, Draw_ScalarPoint);
-          Draw_VectorList(v, ValMin, ValMax, v->VP, v->NbVP, 1, Draw_VectorPoint);
-          Draw_TensorList(v, ValMin, ValMax, v->TP, v->NbTP, 1, Draw_TensorPoint);
-        }
-
-        // Lines
-        if(v->DrawLines) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SL, v->NbSL, 2, 0, Draw_ScalarLine);
-          Draw_VectorList(v, ValMin, ValMax, v->VL, v->NbVL, 2, Draw_VectorLine);
-          Draw_TensorList(v, ValMin, ValMax, v->TL, v->NbTL, 2, Draw_TensorLine);
-        }
-
-        // Triangles
-        if(v->DrawTriangles) {
-          Draw_ScalarList(v, ValMin, ValMax, v->ST, v->NbST, 3, 1, Draw_ScalarTriangle);
-          Draw_VectorList(v, ValMin, ValMax, v->VT, v->NbVT, 3, Draw_VectorTriangle);
-          Draw_TensorList(v, ValMin, ValMax, v->TT, v->NbTT, 3, Draw_TensorTriangle);
-        }
-
-        // Quadrangles
-        if(v->DrawQuadrangles) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SQ, v->NbSQ, 4, 1, Draw_ScalarQuadrangle);
-          Draw_VectorList(v, ValMin, ValMax, v->VQ, v->NbVQ, 4, Draw_VectorQuadrangle);
-          Draw_TensorList(v, ValMin, ValMax, v->TQ, v->NbTQ, 4, Draw_TensorQuadrangle);
-        }
-
-        // Tetrahedra
-        if(v->DrawTetrahedra) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SS, v->NbSS, 4, 1, Draw_ScalarTetrahedron);
-          Draw_VectorList(v, ValMin, ValMax, v->VS, v->NbVS, 4, Draw_VectorTetrahedron);
-          Draw_TensorList(v, ValMin, ValMax, v->TS, v->NbTS, 4, Draw_TensorTetrahedron);
-        }
-
-        // Hexahedra
-        if(v->DrawHexahedra) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SH, v->NbSH, 8, 1, Draw_ScalarHexahedron);
-          Draw_VectorList(v, ValMin, ValMax, v->VH, v->NbVH, 8, Draw_VectorHexahedron);
-          Draw_TensorList(v, ValMin, ValMax, v->TH, v->NbTH, 8, Draw_TensorHexahedron);
-        }
-
-        // Prisms
-        if(v->DrawPrisms) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SI, v->NbSI, 6, 1, Draw_ScalarPrism);
-          Draw_VectorList(v, ValMin, ValMax, v->VI, v->NbVI, 6, Draw_VectorPrism);
-          Draw_TensorList(v, ValMin, ValMax, v->TI, v->NbTI, 6, Draw_TensorPrism);
-        }
-
-        // Pyramids
-        if(v->DrawPyramids) {
-          Draw_ScalarList(v, ValMin, ValMax, v->SY, v->NbSY, 5, 1, Draw_ScalarPyramid);
-          Draw_VectorList(v, ValMin, ValMax, v->VY, v->NbVY, 5, Draw_VectorPyramid);
-          Draw_TensorList(v, ValMin, ValMax, v->TY, v->NbTY, 5, Draw_TensorPyramid);
-        }
-
-        // Strings
-        if(v->DrawStrings) {
-          glColor4ubv((GLubyte *) & CTX.color.text);
-          Draw_Text2D3D(3, v->TimeStep, v->NbT3, v->T3D, v->T3C);
-        }
-
-        if(CTX.post.display_lists)
-          glEndList();
-
-        v->Changed = 0;
+
+      if(CTX.post.vertex_arrays && v->VertexArray){
+	if(v->VertexArray->num_triangles){
+
+	  if(CTX.alpha && ColorTable_IsAlpha(&v->CT) && (changedEye() || v->Changed)){
+	    Msg(DEBUG, "Sorting for transparency (WITH vertex array)");
+	    v->VertexArray->sort(storedEye);
+	  }
+
+	  glVertexPointer(3, GL_FLOAT, 0, v->VertexArray->vertices->array);
+	  glNormalPointer(GL_FLOAT, 0, v->VertexArray->normals->array);
+	  glColorPointer(4, GL_UNSIGNED_BYTE, 0, v->VertexArray->colors->array);
+
+	  glEnableClientState(GL_VERTEX_ARRAY);
+	  glEnableClientState(GL_COLOR_ARRAY);
+	  glEnableClientState(GL_NORMAL_ARRAY);
+
+	  if(v->Light)
+	    glEnable(GL_LIGHTING);
+	  else
+	    glDisableClientState(GL_NORMAL_ARRAY);
+	  glEnable(GL_POLYGON_OFFSET_FILL);
+	  glDrawArrays(GL_TRIANGLES, 0, 3 * v->VertexArray->num_triangles);
+	  glDisable(GL_POLYGON_OFFSET_FILL);
+	  glDisable(GL_LIGHTING);
+	}
+
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_COLOR_ARRAY);
+	glDisableClientState(GL_NORMAL_ARRAY);
       }
 
+      if(v->DrawStrings) {
+	glColor4ubv((GLubyte *) & CTX.color.text);
+	Draw_Text2D3D(3, v->TimeStep, v->NbT3, v->T3D, v->T3C);
+      }
+      
+      v->Changed = 0;
     }
-
   }
 }
diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp
index 635afd3f792ed6f1eda67c2111aadfc0b01492bb..140e79dade35bf3e94e0c5b0f92df67a0bb23c9f 100644
--- a/Graphics/PostElement.cpp
+++ b/Graphics/PostElement.cpp
@@ -1,4 +1,4 @@
-// $Id: PostElement.cpp,v 1.30 2004-05-29 00:47:06 geuzaine Exp $
+// $Id: PostElement.cpp,v 1.31 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -275,8 +275,8 @@ void Draw_ScalarLine(Post_View * View, int preproNormals,
     View->Boundary--;
     int ts = View->TimeStep;
     View->TimeStep = 0;
-    Draw_ScalarPoint(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]);      //0
-    Draw_ScalarPoint(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]);      //1
+    Draw_ScalarPoint(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]); // 0
+    Draw_ScalarPoint(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]); // 1
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -293,9 +293,7 @@ void Draw_ScalarLine(Post_View * View, int preproNormals,
     Draw_ElementBoundary(LINE, View, X, Y, Z, Raise);
 
   if(View->IntervalsType == DRAW_POST_NUMERIC) {
-
     d = (Val[0] + Val[1]) / 2.;
-
     if(d >= ValMin && d <= ValMax) {
       PaletteContinuous(View, ValMin, ValMax, d);
       sprintf(Num, View->Format, d);
@@ -304,61 +302,63 @@ void Draw_ScalarLine(Post_View * View, int preproNormals,
                     (Z[0] + Raise[2][0] + Z[1] + Raise[2][1]) / 2.);
       Draw_String(Num);
     }
-
   }
-  else {
-
-    if(View->IntervalsType == DRAW_POST_CONTINUOUS) {
 
-      if(Val[0] >= ValMin && Val[0] <= ValMax &&
-         Val[1] >= ValMin && Val[1] <= ValMax) {
-        if(View->LineType) {
-          // not perfect...
-          PaletteContinuous(View, ValMin, ValMax, Val[0]);
-          Draw_Line(View->LineType, View->LineWidth, X, Y, Z, Raise, View->Light);
-        }
-        else {
-          glBegin(GL_LINES);
-          PaletteContinuous(View, ValMin, ValMax, Val[0]);
-          glVertex3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]);
-          PaletteContinuous(View, ValMin, ValMax, Val[1]);
-          glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]);
-          glEnd();
-        }
+  if(View->IntervalsType == DRAW_POST_CONTINUOUS) {
+    if(Val[0] >= ValMin && Val[0] <= ValMax &&
+       Val[1] >= ValMin && Val[1] <= ValMax) {
+      if(View->LineType) {
+	// not perfect...
+	PaletteContinuous(View, ValMin, ValMax, Val[0]);
+	Draw_Line(View->LineType, View->LineWidth, X, Y, Z, Raise, View->Light);
       }
       else {
-        //todo
+	glBegin(GL_LINES);
+	PaletteContinuous(View, ValMin, ValMax, Val[0]);
+	glVertex3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]);
+	PaletteContinuous(View, ValMin, ValMax, Val[1]);
+	glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]);
+	glEnd();
       }
-
     }
     else {
-      for(int k = 0; k < View->NbIso; k++) {
-        PaletteDiscrete(View, View->NbIso, k);
-        if(View->IntervalsType == DRAW_POST_DISCRETE) {
-          CutLine1D(X, Y, Z, &Val[0],
-                    View->GVFI(ValMin, ValMax, View->NbIso + 1, k),
-                    View->GVFI(ValMin, ValMax, View->NbIso + 1, k + 1),
-                    Xp, Yp, Zp, &nb, value);
-          if(nb == 2) {
-	    for(int i = 0; i < 3; i++)
-	      for(int l = 0; l < 2; l++)
-		Raise[i][l] = View->Raise[i] * value[l];
-            Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp, Raise, View->Light);
-          }
-        }
-        else {
-          thev = View->GVFI(ValMin, ValMax, View->NbIso, k);
-          CutLine0D(X, Y, Z, &Val[0], thev, Xp, Yp, Zp, &nb);
-          if(nb) {
-	    for(int i = 0; i < 3; i++)
-	      Raise[i][0] = View->Raise[i] * thev;
-            Draw_Point(View->PointType, View->PointSize, Xp, Yp, Zp, Raise, View->Light);
-          }
-        }
+      // FIXME: todo
+    }
+  }
+
+  if(View->IntervalsType == DRAW_POST_DISCRETE) {
+    for(int k = 0; k < View->NbIso; k++) {
+      PaletteDiscrete(View, View->NbIso, k);
+      CutLine1D(X, Y, Z, &Val[0],
+		View->GVFI(ValMin, ValMax, View->NbIso + 1, k),
+		View->GVFI(ValMin, ValMax, View->NbIso + 1, k + 1),
+		Xp, Yp, Zp, &nb, value);
+      if(nb == 2) {
+	for(int i = 0; i < 3; i++)
+	  for(int l = 0; l < 2; l++)
+	    Raise[i][l] = View->Raise[i] * value[l];
+	Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp, Raise, View->Light);
       }
+      if(ValMin == ValMax)
+	break;
     }
+  }
 
+  if(View->IntervalsType == DRAW_POST_ISO) {
+    for(int k = 0; k < View->NbIso; k++) {
+      PaletteDiscrete(View, View->NbIso, k);
+      thev = View->GVFI(ValMin, ValMax, View->NbIso, k);
+      CutLine0D(X, Y, Z, &Val[0], thev, Xp, Yp, Zp, &nb);
+      if(nb) {
+	for(int i = 0; i < 3; i++)
+	  Raise[i][0] = View->Raise[i] * thev;
+	Draw_Point(View->PointType, View->PointSize, Xp, Yp, Zp, Raise, View->Light);
+      }
+      if(ValMin == ValMax)
+	break;
+    }
   }
+
 }
 
 void Draw_ScalarTriangle(Post_View * View, int preproNormals,
@@ -377,10 +377,10 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
     View->Boundary--;
     int ts = View->TimeStep;
     View->TimeStep = 0;
-    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]);       //01
-    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]);       //12
+    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]); // 01
+    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]); // 12
     REORDER2(0, 2);
-    Draw_ScalarLine(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);   //02
+    Draw_ScalarLine(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 02
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -393,8 +393,7 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
     for(int k = 0; k < 3; k++)
       Raise[i][k] = View->Raise[i] * Val[k];
 
-  if(View->Light) {
-
+  if(!View->UseVertexArray && View->Light || View->FillVertexArray) {
     x1x0 = (X[1] + Raise[0][1]) - (X[0] + Raise[0][0]);
     y1y0 = (Y[1] + Raise[1][1]) - (Y[0] + Raise[1][0]);
     z1z0 = (Z[1] + Raise[2][1]) - (Z[0] + Raise[2][0]);
@@ -405,12 +404,12 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
     nn[1] = z1z0 * x2x0 - x1x0 * z2z0;
     nn[2] = x1x0 * y2y0 - y1y0 * x2x0;
     norme(nn);
-
     if(View->SmoothNormals) {
       if(preproNormals) {
         for(int i = 0; i < 3; i++) {
-          View->add_normal(X[i] + Raise[0][i], Y[i] + Raise[1][i],
-                           Z[i] + Raise[2][i], nn[0], nn[1], nn[2]);
+          View->add_normal
+	    (X[i] + Raise[0][i], Y[i] + Raise[1][i], Z[i] + Raise[2][i], 
+	     nn[0], nn[1], nn[2]);
         }
         return;
       }
@@ -419,13 +418,10 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
           norms[3 * i] = nn[0];
           norms[3 * i + 1] = nn[1];
           norms[3 * i + 2] = nn[2];
-          if(!View->get_normal(X[i] + Raise[0][i], Y[i] + Raise[1][i],
-			       Z[i] + Raise[2][i], norms[3 * i], norms[3 * i + 1],
-			       norms[3 * i + 2])) {
-            //don't print this (unless we fix draw_vector_triangle with displacement)
-            //Msg(WARNING, "Oups, did not find smoothed normal");
-          }
-        }
+          View->get_normal
+	    (X[i] + Raise[0][i], Y[i] + Raise[1][i], Z[i] + Raise[2][i], 
+	     norms[3 * i], norms[3 * i + 1], norms[3 * i + 2]);
+	}
       }
     }
     else {
@@ -445,7 +441,6 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
     Draw_ElementBoundary(TRIANGLE, View, X, Y, Z, Raise);
 
   if(View->IntervalsType == DRAW_POST_NUMERIC) {
-
     d = (Val[0] + Val[1] + Val[2]) / 3.;
     if(d >= ValMin && d <= ValMax) {
       PaletteContinuous(View, ValMin, ValMax, d);
@@ -455,83 +450,145 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals,
                     (Z[0] + Raise[2][0] + Z[1] + Raise[2][1] + Z[2] + Raise[2][2]) / 3.);
       Draw_String(Num);
     }
-
   }
-  else {
 
-    if(View->IntervalsType == DRAW_POST_CONTINUOUS) {
-      if(Val[0] >= ValMin && Val[0] <= ValMax &&
-         Val[1] >= ValMin && Val[1] <= ValMax &&
-         Val[2] >= ValMin && Val[2] <= ValMax) {
+  if(!View->UseVertexArray && View->IntervalsType == DRAW_POST_CONTINUOUS) {
+    if(Val[0] >= ValMin && Val[0] <= ValMax &&
+       Val[1] >= ValMin && Val[1] <= ValMax &&
+       Val[2] >= ValMin && Val[2] <= ValMax) {
+      if(View->FillVertexArray){
+	unsigned int col;
+	col = PaletteContinuous(View, ValMin, ValMax, Val[0]);
+	View->VertexArray->add(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0],
+			       norms[0], norms[1], norms[2], col);
+	col = PaletteContinuous(View, ValMin, ValMax, Val[1]);
+	View->VertexArray->add(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1],
+			       norms[3], norms[4], norms[5], col);
+	col = PaletteContinuous(View, ValMin, ValMax, Val[2]);
+	View->VertexArray->add(X[2] + Raise[0][2], Y[2] + Raise[1][2], Z[2] + Raise[2][2],
+			       norms[6], norms[7], norms[8], col);
+	View->VertexArray->num_triangles++;
+      }
+      else{
 	if(View->Light) glEnable(GL_LIGHTING);
 	glEnable(GL_POLYGON_OFFSET_FILL);
-        glBegin(GL_TRIANGLES);
-        PaletteContinuous(View, ValMin, ValMax, Val[0]);
-        glNormal3dv(&norms[0]);
-        glVertex3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]);
-        PaletteContinuous(View, ValMin, ValMax, Val[1]);
-        glNormal3dv(&norms[3]);
-        glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]);
-        PaletteContinuous(View, ValMin, ValMax, Val[2]);
-        glNormal3dv(&norms[6]);
-        glVertex3d(X[2] + Raise[0][2], Y[2] + Raise[1][2], Z[2] + Raise[2][2]);
-        glEnd();
+	glBegin(GL_TRIANGLES);
+	PaletteContinuous(View, ValMin, ValMax, Val[0]);
+	glNormal3dv(&norms[0]);
+	glVertex3d(X[0] + Raise[0][0], Y[0] + Raise[1][0], Z[0] + Raise[2][0]);
+	PaletteContinuous(View, ValMin, ValMax, Val[1]);
+	glNormal3dv(&norms[3]);
+	glVertex3d(X[1] + Raise[0][1], Y[1] + Raise[1][1], Z[1] + Raise[2][1]);
+	PaletteContinuous(View, ValMin, ValMax, Val[2]);
+	glNormal3dv(&norms[6]);
+	glVertex3d(X[2] + Raise[0][2], Y[2] + Raise[1][2], Z[2] + Raise[2][2]);
+	glEnd();
 	glDisable(GL_POLYGON_OFFSET_FILL);
 	glDisable(GL_LIGHTING);
       }
-      else {
-        CutTriangle2D(X, Y, Z, Val, ValMin, ValMax, Xp, Yp, Zp, &nb, value);
-        if(nb >= 3) {
+    }
+    else {
+      CutTriangle2D(X, Y, Z, Val, ValMin, ValMax, Xp, Yp, Zp, &nb, value);
+      if(nb >= 3) {
+	if(View->FillVertexArray){
+	  for(int i = 2; i < nb; i++) {
+	    unsigned int col;
+	    col = PaletteContinuous(View, ValMin, ValMax, value[0]);
+	    View->VertexArray->add(Xp[0] + View->Raise[0] * value[0],
+				   Yp[0] + View->Raise[1] * value[0],
+				   Zp[0] + View->Raise[2] * value[0],
+				   norms[0], norms[1], norms[2], col);
+	    col = PaletteContinuous(View, ValMin, ValMax, value[i-1]);
+	    View->VertexArray->add(Xp[i-1] + View->Raise[0] * value[i-1],
+				   Yp[i-1] + View->Raise[1] * value[i-1],
+				   Zp[i-1] + View->Raise[2] * value[i-1],
+				   norms[0], norms[1], norms[2], col);
+	    col = PaletteContinuous(View, ValMin, ValMax, value[i]);
+	    View->VertexArray->add(Xp[i] + View->Raise[0] * value[i],
+				   Yp[i] + View->Raise[1] * value[i],
+				   Zp[i] + View->Raise[2] * value[i],
+				   norms[0], norms[1], norms[2], col);
+	    View->VertexArray->num_triangles++;	    
+	  }
+	}
+	else{
 	  if(View->Light) glEnable(GL_LIGHTING);
 	  glEnable(GL_POLYGON_OFFSET_FILL);
-          glBegin(GL_POLYGON);
-          for(int i = 0; i < nb; i++) {
-            PaletteContinuous(View, ValMin, ValMax, value[i]);
-            glVertex3d(Xp[i] + View->Raise[0] * value[i], 
+	  glBegin(GL_POLYGON);
+	  for(int i = 0; i < nb; i++) {
+	    PaletteContinuous(View, ValMin, ValMax, value[i]);
+	    glVertex3d(Xp[i] + View->Raise[0] * value[i], 
 		       Yp[i] + View->Raise[1] * value[i], 
 		       Zp[i] + View->Raise[2] * value[i]);
-          }
-          glEnd();
+	  }
+	  glEnd();
 	  glDisable(GL_POLYGON_OFFSET_FILL);
 	  glDisable(GL_LIGHTING);
-        }
+	}
       }
     }
-    else {
-      for(int k = 0; k < View->NbIso; k++) {
-	PaletteDiscrete(View, View->NbIso, k);
-        if(View->IntervalsType == DRAW_POST_DISCRETE) {
-          CutTriangle2D(X, Y, Z, Val,
-                        View->GVFI(ValMin, ValMax, View->NbIso + 1, k),
-                        View->GVFI(ValMin, ValMax, View->NbIso + 1, k + 1),
-                        Xp, Yp, Zp, &nb, value);
-          if(nb >= 3) {
-	    if(View->Light) glEnable(GL_LIGHTING);
-	    glEnable(GL_POLYGON_OFFSET_FILL);
-            glBegin(GL_POLYGON);
-            for(int i = 0; i < nb; i++)
-              glVertex3d(Xp[i] + View->Raise[0] * value[i],
-			 Yp[i] + View->Raise[1] * value[i], 
-			 Zp[i] + View->Raise[2] * value[i]);
-            glEnd();
-	    glDisable(GL_POLYGON_OFFSET_FILL);
-	    glDisable(GL_LIGHTING);
-          }
-        }
-        else {
-          thev = View->GVFI(ValMin, ValMax, View->NbIso, k);
-          CutTriangle1D(X, Y, Z, Val, thev, Xp, Yp, Zp, &nb);
-          if(nb == 2) {
-            for(int i = 0; i < 3; i++)
-	      for(int l = 0; l < 2; l++)
-		Raise[i][l] = View->Raise[i] * thev;
-            Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp, Raise, View->Light);
-          }
-        }
+  }
+
+  if(!View->UseVertexArray && View->IntervalsType == DRAW_POST_DISCRETE) {
+    for(int k = 0; k < View->NbIso; k++) {
+      unsigned int col = PaletteDiscrete(View, View->NbIso, k);
+      CutTriangle2D(X, Y, Z, Val,
+		    View->GVFI(ValMin, ValMax, View->NbIso + 1, k),
+		    View->GVFI(ValMin, ValMax, View->NbIso + 1, k + 1),
+		    Xp, Yp, Zp, &nb, value);
+      if(nb >= 3) {
+	if(View->FillVertexArray){
+	  for(int i = 2; i < nb; i++) {
+	    View->VertexArray->add(Xp[0] + View->Raise[0] * value[0],
+				   Yp[0] + View->Raise[1] * value[0],
+				   Zp[0] + View->Raise[2] * value[0],
+				   norms[0], norms[1], norms[2], col);
+	    View->VertexArray->add(Xp[i-1] + View->Raise[0] * value[i-1],
+				   Yp[i-1] + View->Raise[1] * value[i-1],
+				   Zp[i-1] + View->Raise[2] * value[i-1],
+				   norms[0], norms[1], norms[2], col);
+	    View->VertexArray->add(Xp[i] + View->Raise[0] * value[i],
+				   Yp[i] + View->Raise[1] * value[i],
+				   Zp[i] + View->Raise[2] * value[i],
+				   norms[0], norms[1], norms[2], col);
+	    View->VertexArray->num_triangles++;
+	  }
+	}
+	else{
+	  if(View->Light) glEnable(GL_LIGHTING);
+	  glEnable(GL_POLYGON_OFFSET_FILL);
+	  glBegin(GL_POLYGON);
+	  for(int i = 0; i < nb; i++)
+	    glVertex3d(Xp[i] + View->Raise[0] * value[i],
+		       Yp[i] + View->Raise[1] * value[i], 
+		       Zp[i] + View->Raise[2] * value[i]);
+	  glEnd();
+	  glDisable(GL_POLYGON_OFFSET_FILL);
+	  glDisable(GL_LIGHTING);
+	}
+      }
+      if(ValMin == ValMax) 
+	break;
+    }
+  }
+
+  if(View->IntervalsType == DRAW_POST_ISO) {
+    for(int k = 0; k < View->NbIso; k++) {
+      PaletteDiscrete(View, View->NbIso, k);
+      thev = View->GVFI(ValMin, ValMax, View->NbIso, k);
+      CutTriangle1D(X, Y, Z, Val, thev, Xp, Yp, Zp, &nb);
+      if(nb == 2) {
+	for(int i = 0; i < 3; i++)
+	  for(int l = 0; l < 2; l++)
+	    Raise[i][l] = View->Raise[i] * thev;
+	Draw_Line(View->LineType, View->LineWidth, Xp, Yp, Zp,
+		  Raise, View->Light);
       }
+      if(ValMin == ValMax) 
+	break;
     }
-    
   }
+
 }
 
 void Draw_ScalarTetrahedron(Post_View * View, int preproNormals,
@@ -548,15 +605,15 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals,
     View->Boundary--;
     int ts = View->TimeStep;
     View->TimeStep = 0;
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]);   //012
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]);   //123
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]); // 012
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]); // 123
     REORDER3(0, 1, 3);
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);       //013
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 013
     Xp[1] = X[2];
     Yp[1] = Y[2];
     Zp[1] = Z[2];
     Val[1] = vv[2];
-    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);       //023
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 023
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -573,7 +630,6 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals,
     Draw_ElementBoundary(TETRAHEDRON, View, X, Y, Z, Raise);
 
   if(!preproNormals && View->IntervalsType == DRAW_POST_NUMERIC) {
-
     d = 0.25 * (Val[0] + Val[1] + Val[2] + Val[3]);
     if(d >= ValMin && d <= ValMax) {
       PaletteContinuous(View, ValMin, ValMax, d);
@@ -586,16 +642,15 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals,
                             Z[2] + Raise[2][2] + Z[3] + Raise[2][3]));
       Draw_String(Num);
     }
-
   }
-  else {
+  else if(!View->UseVertexArray){
     for(int k = 0; k < View->NbIso; k++) {
-      if(!preproNormals)
-        PaletteDiscrete(View, View->NbIso, k);
+      unsigned int col = PaletteDiscrete(View, View->NbIso, k);
       IsoSimplex(View, preproNormals, X, Y, Z, Val,
-                 View->GVFI(ValMin, ValMax, View->NbIso, k));
+                 View->GVFI(ValMin, ValMax, View->NbIso, k), col);
+      if(ValMin == ValMax)
+	break;
     }
-
   }
 }
 
@@ -612,11 +667,11 @@ void Draw_ScalarQuadrangle(Post_View * View, int preproNormals,
 
   if(!preproNormals && View->Boundary > 0) {
     View->Boundary--;
-    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]);       //01
-    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]);       //12
-    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[2], &Y[2], &Z[2], &vv[2]);       //23
+    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[0], &Y[0], &Z[0], &vv[0]); // 01
+    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[1], &Y[1], &Z[1], &vv[1]); // 12
+    Draw_ScalarLine(View, 0, ValMin, ValMax, &X[2], &Y[2], &Z[2], &vv[2]); // 23
     REORDER2(0, 3);
-    Draw_ScalarLine(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);   //03
+    Draw_ScalarLine(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 03
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -634,9 +689,9 @@ void Draw_ScalarQuadrangle(Post_View * View, int preproNormals,
     Draw_ElementBoundary(QUADRANGLE, View, X, Y, Z, Raise);
   }
 
-  Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, X, Y, Z, vv); //012
+  Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, X, Y, Z, vv); // 012
   REORDER3(0, 2, 3);
-  Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val);     //023
+  Draw_ScalarTriangle(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 023
 
   View->TimeStep = ts;
   View->ShowElement = show;
@@ -656,16 +711,16 @@ void Draw_ScalarHexahedron(Post_View * View, int preproNormals,
   if(!preproNormals && View->Boundary > 0) {
     View->Boundary--;
     REORDER4(0, 1, 5, 4);
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);     //0154
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 0154
     REORDER4(0, 3, 2, 1);
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);     //0321
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 0321
     REORDER4(0, 4, 7, 3);
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);     //0473
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 0473
     REORDER4(1, 2, 6, 5);
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);     //1265
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 1265
     REORDER4(2, 3, 7, 6);
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);     //2376
-    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, &X[4], &Y[4], &Z[4], &vv[4]); //4567
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val); // 2376
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, &X[4], &Y[4], &Z[4], &vv[4]); // 4567
     View->TimeStep = ts;
     View->Boundary++;
     return;
@@ -731,11 +786,11 @@ void Draw_ScalarPrism(Post_View * View, int preproNormals,
     Draw_ElementBoundary(PRISM, View, X, Y, Z, Raise);
   }
 
-  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, X, Y, Z, vv); //0123
+  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, X, Y, Z, vv); // 0123
   REORDER4(3, 4, 5, 2);
-  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val);  //3452
+  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 3452
   REORDER4(1, 2, 4, 3);
-  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val);  //1243
+  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val); // 1243
 
   View->TimeStep = ts;
   View->ShowElement = show;
@@ -745,11 +800,49 @@ void Draw_ScalarPyramid(Post_View * View, int preproNormals,
                         double ValMin, double ValMax,
                         double *X, double *Y, double *Z, double *V)
 {
-  static int error = 0;
-  if(!error) {
-    error = 1;
-    Msg(WARNING, "Pyramid drawing not implemented yet...");
+  int ts, show = 0;
+  double Val[5], Xp[5], Yp[5], Zp[5];
+  double *vv = &V[5 * View->TimeStep];
+
+  ts = View->TimeStep;
+  View->TimeStep = 0;
+
+  if(!preproNormals && View->Boundary > 0) {
+    View->Boundary--;
+    REORDER4(0, 3, 2, 1);
+    Draw_ScalarQuadrangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
+    REORDER3(0, 1, 4);
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
+    REORDER3(1, 2, 4);
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
+    REORDER3(2, 3, 4);
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
+    REORDER3(3, 0, 4);
+    Draw_ScalarTriangle(View, 0, ValMin, ValMax, Xp, Yp, Zp, Val);
+    View->TimeStep = ts;
+    View->Boundary++;
+    return;
+  }
+
+  show = View->ShowElement;
+  View->ShowElement = 0;
+
+  if(!preproNormals && show) {
+    SaturateValues(View->SaturateValues, ValMin, ValMax, vv, Val, 6);
+    double Raise[3][8];
+    for(int i = 0; i < 3; i++)
+      for(int k = 0; k < 5; k++)
+	Raise[i][k] = View->Raise[i] * Val[k];
+    Draw_ElementBoundary(PYRAMID, View, X, Y, Z, Raise);
   }
+
+  REORDER4(0, 1, 2, 4);
+  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val);
+  REORDER4(2, 3, 0, 4);
+  Draw_ScalarTetrahedron(View, preproNormals, ValMin, ValMax, Xp, Yp, Zp, Val);
+
+  View->TimeStep = ts;
+  View->ShowElement = show;
 }
 
 // Vector Elements
@@ -765,30 +858,14 @@ void Draw_VectorElement(int type, Post_View * View,
   char Num[100];
 
   switch (type) {
-  case POINT:
-    nbnod = 1;
-    break;
-  case LINE:
-    nbnod = 2;
-    break;
-  case TRIANGLE:
-    nbnod = 3;
-    break;
-  case QUADRANGLE:
-    nbnod = 4;
-    break;
-  case TETRAHEDRON:
-    nbnod = 4;
-    break;
-  case HEXAHEDRON:
-    nbnod = 8;
-    break;
-  case PRISM:
-    nbnod = 6;
-    break;
-  case PYRAMID:
-    nbnod = 5;
-    break;
+  case POINT: nbnod = 1; break;
+  case LINE: nbnod = 2; break;
+  case TRIANGLE: nbnod = 3; break;
+  case QUADRANGLE: nbnod = 4; break;
+  case TETRAHEDRON: nbnod = 4; break;
+  case HEXAHEDRON: nbnod = 8; break;
+  case PRISM: nbnod = 6; break;
+  case PYRAMID: nbnod = 5; break;
   }
 
   for(int k = 0; k < nbnod; k++) {
@@ -1023,30 +1100,14 @@ void Draw_TensorElement(int type, Post_View * View,
   int nbnod = 0;
 
   switch (type) {
-  case POINT:
-    nbnod = 1;
-    break;
-  case LINE:
-    nbnod = 2;
-    break;
-  case TRIANGLE:
-    nbnod = 3;
-    break;
-  case QUADRANGLE:
-    nbnod = 4;
-    break;
-  case TETRAHEDRON:
-    nbnod = 4;
-    break;
-  case HEXAHEDRON:
-    nbnod = 8;
-    break;
-  case PRISM:
-    nbnod = 6;
-    break;
-  case PYRAMID:
-    nbnod = 5;
-    break;
+  case POINT: nbnod = 1; break;
+  case LINE: nbnod = 2; break;
+  case TRIANGLE: nbnod = 3; break;
+  case QUADRANGLE: nbnod = 4; break;
+  case TETRAHEDRON: nbnod = 4; break;
+  case HEXAHEDRON: nbnod = 8; break;
+  case PRISM: nbnod = 6; break;
+  case PYRAMID: nbnod = 5; break;
   }
 
   /// By lack of any current better solution, tensors are displayed as
diff --git a/Graphics/Scale.cpp b/Graphics/Scale.cpp
index 27fc30acb04f6d1e4af2cf7b106c147fe9d243cc..7478fa8d00abc548cf855ae3094b10ae6af21d10 100644
--- a/Graphics/Scale.cpp
+++ b/Graphics/Scale.cpp
@@ -1,4 +1,4 @@
-// $Id: Scale.cpp,v 1.42 2004-04-27 00:11:55 geuzaine Exp $
+// $Id: Scale.cpp,v 1.43 2004-05-29 10:11:12 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -141,7 +141,6 @@ void draw_scale(Post_View * v,
 
   glColor4ubv((GLubyte *) & CTX.color.text);
 
-
   if(nbv < 0) { // only min and max if not enough room
     if(v->IntervalsType == DRAW_POST_DISCRETE ||
        v->IntervalsType == DRAW_POST_CONTINUOUS) {
diff --git a/Mesh/Makefile b/Mesh/Makefile
index c76625ad5e90b17c94b997c5cc0d271a463840e3..c4a799bb1d12c1e04b3d4a0e698826ecb36a00f1 100644
--- a/Mesh/Makefile
+++ b/Mesh/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.64 2004-05-27 20:49:03 geuzaine Exp $
+# $Id: Makefile,v 1.65 2004-05-29 10:11:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -102,238 +102,250 @@ depend:
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h Utils.h \
-  ../Common/Context.h Interpolation.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h \
+  Utils.h ../Common/Context.h Interpolation.h
 2D_Mesh.o: 2D_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Utils.h Create.h \
-  2D_Mesh.h ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Utils.h Create.h 2D_Mesh.h ../Common/Context.h
 2D_Transfinite.o: 2D_Transfinite.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h Mesh.h Vertex.h \
-  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h ../Numeric/Numeric.h Interpolation.h
+  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  ../Common/VertexArray.h Metric.h Matrix.h ../Numeric/Numeric.h \
+  Interpolation.h
 2D_Elliptic.o: 2D_Elliptic.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h
 2D_BGMesh.o: 2D_BGMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h
 2D_Recombine.o: 2D_Recombine.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h Utils.h 2D_Mesh.h Create.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h Utils.h 2D_Mesh.h Create.h \
+  ../Common/Context.h
 2D_InitMesh.o: 2D_InitMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h
 2D_Bowyer.o: 2D_Bowyer.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h
 2D_Bricks.o: 2D_Bricks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h
 2D_DivAndConq.o: 2D_DivAndConq.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h
 2D_Util.o: 2D_Util.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
 2D_Links.o: 2D_Links.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h 2D_Mesh.h ../Common/Context.h
 2D_Tree.o: 2D_Tree.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
-  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h
+  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h \
+  Metric.h Matrix.h 2D_Mesh.h
 2D_Cylindrical.o: 2D_Cylindrical.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h ../Common/Context.h
 2D_Parametric.o: 2D_Parametric.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h \
-  2D_Mesh.h Create.h ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Interpolation.h 2D_Mesh.h Create.h ../Common/Context.h
 2D_Mesh_Aniso.o: 2D_Mesh_Aniso.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h \
-  Create.h ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Interpolation.h Create.h ../Common/Context.h
 2D_Mesh_Triangle.o: 2D_Mesh_Triangle.cpp ../Common/Gmsh.h \
   ../Common/Message.h ../DataStr/Malloc.h ../DataStr/List.h \
   ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h \
-  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h ../Numeric/Numeric.h ../Common/Context.h
+  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  ../Common/VertexArray.h Metric.h Matrix.h ../Numeric/Numeric.h \
+  ../Common/Context.h
 3D_Mesh.o: 3D_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h 3D_Mesh.h Create.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h 3D_Mesh.h Create.h \
+  ../Common/Context.h
 3D_Transfinite.o: 3D_Transfinite.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
-  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
-  Interpolation.h Create.h
+  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h \
+  Metric.h Matrix.h Interpolation.h Create.h
 3D_BGMesh.o: 3D_BGMesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
-  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 2D_Mesh.h \
-  3D_Mesh.h ../Common/Views.h ../Common/ColorTable.h ../Numeric/Numeric.h \
-  ../Common/Context.h
+  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h \
+  Metric.h Matrix.h 2D_Mesh.h 3D_Mesh.h ../Common/Views.h \
+  ../Common/ColorTable.h ../Numeric/Numeric.h ../Common/Context.h
 3D_Extrude.o: 3D_Extrude.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Context.h \
-  Create.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Common/Context.h Create.h
 3D_Extrude_Old.o: 3D_Extrude_Old.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Context.h \
-  Create.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Common/Context.h Create.h
 3D_Coherence.o: 3D_Coherence.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h 3D_Mesh.h Create.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h \
+  3D_Mesh.h Create.h
 3D_Divide.o: 3D_Divide.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h
+  ../Common/VertexArray.h Metric.h Matrix.h
 3D_Bricks.o: 3D_Bricks.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h
+  ../Common/VertexArray.h Metric.h Matrix.h
 MeshQuality.o: MeshQuality.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h
+  ../Common/VertexArray.h Metric.h Matrix.h
 Create.o: Create.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Utils.h \
-  ../Common/Context.h Create.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Utils.h ../Common/Context.h Create.h
 Generator.o: Generator.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h Create.h ../Common/Context.h ../Parser/OpenFile.h \
-  ../Common/Views.h ../Common/ColorTable.h
+  ../Common/VertexArray.h Metric.h Matrix.h Create.h ../Common/Context.h \
+  ../Parser/OpenFile.h ../Common/Views.h ../Common/ColorTable.h
 Print_Mesh.o: Print_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Create.h \
-  ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Create.h ../Common/Context.h
 Read_Mesh.o: Read_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h ../Geo/CAD.h \
   ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
   ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
-  ../Mesh/Metric.h ../Mesh/Matrix.h 3D_Mesh.h Create.h ../Geo/MinMax.h \
-  ../Common/Context.h
+  ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h 3D_Mesh.h \
+  Create.h ../Geo/MinMax.h ../Common/Context.h
 STL.o: STL.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Geo/CAD.h \
-  ../Geo/Geo.h Create.h Interpolation.h ../Common/Context.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h \
+  ../Geo/CAD.h ../Geo/Geo.h Create.h Interpolation.h ../Common/Context.h
 SwapEdge.o: SwapEdge.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h SwapPatterns.h
+  ../Common/VertexArray.h Metric.h Matrix.h SwapPatterns.h
 Utils.o: Utils.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h \
-  ../Common/Context.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Interpolation.h ../Common/Context.h
 Metric.o: Metric.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Interpolation.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Interpolation.h
 Nurbs.o: Nurbs.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Nurbs.h Vertex.h Mesh.h Element.h \
-  Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h \
-  ../Geo/Geo.h ../Geo/GeoUtils.h Create.h ../Geo/CAD.h
+  Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  ../Common/VertexArray.h Metric.h Matrix.h ../Geo/Geo.h \
+  ../Geo/GeoUtils.h Create.h ../Geo/CAD.h
 Interpolation.o: Interpolation.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   Nurbs.h Vertex.h Mesh.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Geo/CAD.h Utils.h \
-  Interpolation.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h \
+  ../Geo/CAD.h Utils.h Interpolation.h
 SecondOrder.o: SecondOrder.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Geo/Geo.h Mesh.h Vertex.h \
-  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h \
-  Matrix.h Utils.h Interpolation.h ../Numeric/Numeric.h
+  Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
+  ../Common/VertexArray.h Metric.h Matrix.h Utils.h Interpolation.h \
+  ../Numeric/Numeric.h
 Smoothing.o: Smoothing.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Mesh.h \
   Vertex.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h
+  ../Common/VertexArray.h Metric.h Matrix.h
 CrossData.o: CrossData.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
-  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
+  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h \
+  Metric.h Matrix.h
 Vertex.o: Vertex.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h Vertex.h \
   Mesh.h Element.h Simplex.h Face.h Edge.h ../Geo/ExtrudeParams.h STL.h \
-  Metric.h Matrix.h ../Common/Context.h
+  ../Common/VertexArray.h Metric.h Matrix.h ../Common/Context.h
 Edge.o: Edge.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h
 Face.o: Face.cpp ../Common/Gmsh.h ../Common/Message.h ../DataStr/Malloc.h \
   ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
   ../Numeric/Numeric.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h
 Element.o: Element.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Mesh.h Vertex.h Element.h Simplex.h \
-  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h
+  Face.h Edge.h ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h \
+  Metric.h Matrix.h
 Simplex.o: Simplex.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \
-  ../Geo/ExtrudeParams.h STL.h Metric.h Matrix.h ../Common/Context.h
+  ../Geo/ExtrudeParams.h STL.h ../Common/VertexArray.h Metric.h Matrix.h \
+  ../Common/Context.h
diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h
index 6b86c995915da6b40cf80011f804977bbb553585..f9fad0f17a3248878e5cf6212f87744b63b23329 100644
--- a/Mesh/Mesh.h
+++ b/Mesh/Mesh.h
@@ -28,6 +28,7 @@
 #include "Edge.h"
 #include "ExtrudeParams.h"
 #include "STL.h"
+#include "VertexArray.h"
 
 #define FORMAT_MSH           1
 #define FORMAT_UNV           2
@@ -223,24 +224,6 @@ class DrawingColor{
   unsigned int geom, mesh;
 };
 
-class triangleVertexArray{
- public:
-  int num_triangles;
-  float *vertices, *normals;
-  unsigned char *colors;
-  triangleVertexArray(int nb){
-    num_triangles = 0;
-    vertices = new float[nb * 3 * 3];
-    normals = new float[nb * 3 * 3];
-    colors = new unsigned char[nb * 3 * 4];
-  }
-  ~triangleVertexArray(){
-    delete [] vertices;
-    delete [] normals;
-    delete [] colors;
-  }
-};
-
 struct _Surf{
   int Num;
   int Typ;
diff --git a/Parser/Makefile b/Parser/Makefile
index 527e0db3b977bda86951f4fd942f53e5960e6d56..192d5c4b22f2d20b1e60ded93204bdc047db733b 100644
--- a/Parser/Makefile
+++ b/Parser/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.58 2004-05-25 23:16:32 geuzaine Exp $
+# $Id: Makefile,v 1.59 2004-05-29 10:11:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -64,27 +64,30 @@ Gmsh.yy.o: Gmsh.yy.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h ../Geo/Geo.h \
   ../Geo/CAD.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h Gmsh.tab.hpp
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  Gmsh.tab.hpp
 Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Parallel/ParUtil.h \
-  ../Common/Gmsh.h ../DataStr/Malloc.h ../DataStr/Tree.h ../DataStr/avl.h \
-  ../DataStr/Tools.h ../Numeric/Numeric.h ../Common/Context.h \
-  ../Geo/Geo.h ../Geo/GeoUtils.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Mesh/Nurbs.h ../Geo/CAD.h ../Graphics/Draw.h ../Mesh/Create.h \
-  ../Geo/StepGeomDatabase.h ../Common/Colors.h Parser.h OpenFile.h \
-  ../Common/CommandLine.h FunctionManager.h ../Common/Timer.h \
-  ../Graphics/CreateFile.h ../Common/Visibility.h
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Parallel/ParUtil.h ../Common/Gmsh.h ../DataStr/Malloc.h \
+  ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \
+  ../Numeric/Numeric.h ../Common/Context.h ../Geo/Geo.h ../Geo/GeoUtils.h \
+  ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h \
+  ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h \
+  ../Mesh/Metric.h ../Mesh/Matrix.h ../Mesh/Nurbs.h ../Geo/CAD.h \
+  ../Graphics/Draw.h ../Mesh/Create.h ../Geo/StepGeomDatabase.h \
+  ../Common/Colors.h Parser.h OpenFile.h ../Common/CommandLine.h \
+  FunctionManager.h ../Common/Timer.h ../Graphics/CreateFile.h \
+  ../Common/Visibility.h
 OpenFile.o: OpenFile.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h ../Numeric/Numeric.h \
   ../Common/Context.h Parser.h OpenFile.h ../Common/CommandLine.h \
   ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h ../Mesh/Element.h \
   ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h ../Geo/ExtrudeParams.h \
-  ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h ../Common/Views.h \
-  ../Common/ColorTable.h ../Geo/MinMax.h ../Common/Visibility.h \
-  ../Graphics/ReadImg.h ../Common/GmshUI.h ../Graphics/Draw.h \
-  ../Fltk/GUI.h ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h
+  ../Mesh/STL.h ../Common/VertexArray.h ../Mesh/Metric.h ../Mesh/Matrix.h \
+  ../Common/Views.h ../Common/ColorTable.h ../Geo/MinMax.h \
+  ../Common/Visibility.h ../Graphics/ReadImg.h ../Common/GmshUI.h \
+  ../Graphics/Draw.h ../Fltk/GUI.h ../Fltk/Opengl_Window.h \
+  ../Fltk/Colorbar_Window.h
 FunctionManager.o: FunctionManager.cpp FunctionManager.h
diff --git a/Plugin/Makefile b/Plugin/Makefile
index deb4f971efcea9b6926bcc56dad8d06d8f37937e..94d6493c49aee2eb8441bb008398585730106f40 100644
--- a/Plugin/Makefile
+++ b/Plugin/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.48 2004-05-25 23:16:32 geuzaine Exp $
+# $Id: Makefile,v 1.49 2004-05-29 10:11:12 geuzaine Exp $
 #
 # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 #
@@ -67,74 +67,82 @@ depend:
 # DO NOT DELETE THIS LINE
 Plugin.o: Plugin.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
-  PluginManager.h CutMap.h Levelset.h CutGrid.h StreamLines.h CutPlane.h \
-  CutSphere.h Skin.h ../DataStr/Tree.h ../DataStr/avl.h Extract.h \
-  Harmonic2Time.h DecomposeInSimplex.h Smooth.h Transform.h Triangulate.h \
-  SphericalRaise.h DisplacementRaise.h Evaluate.h
+  ../Common/VertexArray.h PluginManager.h CutMap.h Levelset.h CutGrid.h \
+  StreamLines.h CutPlane.h CutSphere.h Skin.h ../DataStr/Tree.h \
+  ../DataStr/avl.h Extract.h Harmonic2Time.h DecomposeInSimplex.h \
+  Smooth.h Transform.h Triangulate.h SphericalRaise.h DisplacementRaise.h \
+  Evaluate.h
 Levelset.o: Levelset.cpp Levelset.h Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h DecomposeInSimplex.h ../DataStr/Tools.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../Graphics/Iso.h \
+  ../DataStr/List.h ../Common/VertexArray.h DecomposeInSimplex.h \
+  ../DataStr/Tools.h ../DataStr/Tree.h ../DataStr/avl.h ../Graphics/Iso.h \
   ../Numeric/Numeric.h ../Common/Context.h ../DataStr/Malloc.h
 CutPlane.o: CutPlane.cpp CutPlane.h Levelset.h Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Common/Context.h
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Common/Context.h
 CutSphere.o: CutSphere.cpp CutSphere.h Levelset.h Plugin.h \
   ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Common/Context.h
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Common/Context.h
 CutMap.o: CutMap.cpp CutMap.h Levelset.h Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h ../Common/Context.h
+  ../DataStr/List.h ../Common/VertexArray.h ../Common/Context.h
 Smooth.o: Smooth.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
-  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h Smooth.h \
-  ../Common/Context.h
+  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
+  ../Common/VertexArray.h Smooth.h ../Common/Context.h
 Octree.o: Octree.cpp Octree.h OctreeInternals.h
 OctreeInternals.o: OctreeInternals.cpp ../Common/Message.h \
   OctreeInternals.h
 OctreePost.o: OctreePost.cpp Octree.h OctreeInternals.h OctreePost.h \
   ../DataStr/List.h ../Common/Views.h ../Common/ColorTable.h \
-  ../Numeric/Numeric.h ../Common/Message.h
+  ../Common/VertexArray.h ../Numeric/Numeric.h ../Common/Message.h
 StreamLines.o: StreamLines.cpp OctreePost.h Octree.h OctreeInternals.h \
   StreamLines.h Plugin.h ../Common/Options.h ../Common/Message.h \
   ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
-  ../Common/Context.h
+  ../Common/VertexArray.h ../Common/Context.h
 CutGrid.o: CutGrid.cpp OctreePost.h Octree.h OctreeInternals.h CutGrid.h \
   Plugin.h ../Common/Options.h ../Common/Message.h ../Common/Views.h \
-  ../Common/ColorTable.h ../DataStr/List.h ../Common/Context.h
+  ../Common/ColorTable.h ../DataStr/List.h ../Common/VertexArray.h \
+  ../Common/Context.h
 Transform.o: Transform.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h Transform.h ../Common/Context.h
+  ../DataStr/List.h ../Common/VertexArray.h Transform.h \
+  ../Common/Context.h
 Triangulate.o: Triangulate.cpp ../Common/Gmsh.h ../Common/Message.h \
   ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \
   ../DataStr/avl.h ../DataStr/Tools.h Plugin.h ../Common/Options.h \
-  ../Common/Views.h ../Common/ColorTable.h Triangulate.h \
-  ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h ../Mesh/Vertex.h \
-  ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h ../Mesh/Edge.h \
-  ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h ../Mesh/Matrix.h \
-  ../Mesh/Utils.h ../Mesh/Create.h
+  ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \
+  Triangulate.h ../Common/Context.h ../Geo/Geo.h ../Mesh/Mesh.h \
+  ../Mesh/Vertex.h ../Mesh/Element.h ../Mesh/Simplex.h ../Mesh/Face.h \
+  ../Mesh/Edge.h ../Geo/ExtrudeParams.h ../Mesh/STL.h ../Mesh/Metric.h \
+  ../Mesh/Matrix.h ../Mesh/Utils.h ../Mesh/Create.h
 SphericalRaise.o: SphericalRaise.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h SphericalRaise.h ../Common/Context.h \
-  ../Numeric/Numeric.h
+  ../DataStr/List.h ../Common/VertexArray.h SphericalRaise.h \
+  ../Common/Context.h ../Numeric/Numeric.h
 DisplacementRaise.o: DisplacementRaise.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h DisplacementRaise.h ../Common/Context.h \
-  ../Numeric/Numeric.h
+  ../DataStr/List.h ../Common/VertexArray.h DisplacementRaise.h \
+  ../Common/Context.h ../Numeric/Numeric.h
 Skin.o: Skin.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
-  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h Skin.h \
-  ../DataStr/Tree.h ../DataStr/avl.h ../Common/Context.h \
-  ../DataStr/Malloc.h
-Extract.o: Extract.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
-  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h Extract.h \
+  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
+  ../Common/VertexArray.h Skin.h ../DataStr/Tree.h ../DataStr/avl.h \
   ../Common/Context.h ../DataStr/Malloc.h
+Extract.o: Extract.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
+  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
+  ../Common/VertexArray.h Extract.h ../Common/Context.h \
+  ../DataStr/Malloc.h
 DecomposeInSimplex.o: DecomposeInSimplex.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h DecomposeInSimplex.h ../DataStr/Tree.h \
-  ../DataStr/avl.h ../Common/Context.h ../DataStr/Malloc.h
+  ../DataStr/List.h ../Common/VertexArray.h DecomposeInSimplex.h \
+  ../DataStr/Tree.h ../DataStr/avl.h ../Common/Context.h \
+  ../DataStr/Malloc.h
 Evaluate.o: Evaluate.cpp Plugin.h ../Common/Options.h ../Common/Message.h \
-  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h Evaluate.h \
-  ../Common/Context.h ../Numeric/Numeric.h
+  ../Common/Views.h ../Common/ColorTable.h ../DataStr/List.h \
+  ../Common/VertexArray.h Evaluate.h ../Common/Context.h \
+  ../Numeric/Numeric.h
 Harmonic2Time.o: Harmonic2Time.cpp Plugin.h ../Common/Options.h \
   ../Common/Message.h ../Common/Views.h ../Common/ColorTable.h \
-  ../DataStr/List.h Harmonic2Time.h ../Common/Context.h \
-  ../Numeric/Numeric.h
+  ../DataStr/List.h ../Common/VertexArray.h Harmonic2Time.h \
+  ../Common/Context.h ../Numeric/Numeric.h
diff --git a/doc/FAQ b/doc/FAQ
index a3187a209ec81a1746743c262f795aab3c9fde31..1ccba56da014a1767527a82b50fb8291632a7723 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,4 +1,4 @@
-$Id: FAQ,v 1.36 2004-05-25 04:10:10 geuzaine Exp $
+$Id: FAQ,v 1.37 2004-05-29 10:11:12 geuzaine Exp $
 
 This is the Gmsh FAQ
 
@@ -215,8 +215,3 @@ Section 7: Post-processing module
 Are you are executing Gmsh from a remote host (via the network) without GLX?
 You should turn double buffering off (with the -nodb command line option).
 
-* 7.2 Big post-processing scenes are slow to display.
-
-Try display lists (Tools->Options->Display->Use display lists).
-
-
diff --git a/doc/VERSIONS b/doc/VERSIONS
index 3a07b70ceafbbbbfbfae5235be8a918e94edc064..bb111ba2885697ac7588379886230bf5df596521 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,19 +1,20 @@
-$Id: VERSIONS,v 1.213 2004-05-28 21:20:48 geuzaine Exp $
+$Id: VERSIONS,v 1.214 2004-05-29 10:11:12 geuzaine Exp $
 
 New in 1.53: completed support for second order elements (lines,
 triangles, quadrangles, tetrahedra, hexahedra, prisms and pyramids);
-various background mesh fixes and enhancements; new Plugin(Evaluate)
-to evaluate arbitrary expressions on post-processing views;
-generalized Plugin(Extract) to handle any combination of components;
-generalized "Coherence" to handle transfinite surface/volume
-attributes; plugin options can now be set in the option file (like all
-other options); added "undo" capability during geometry creation;
-rewrote the contour guessing routines so that entities can be selected
-in an arbitrary order; Mac users can now double click on geo/msh/pos
-files in the Finder to launch Gmsh; removed support for fltk 1.0;
-rewrote most of the code related to quadrangles; fixed 2d elliptic
-algorithm; experimental use of vertex arrays in mesh drawing code
-(triangles only) to sped up the rendering; many code cleanups;
+various background mesh fixes and enhancements; major performance
+improvements for mesh and post-processing drawing speed (OpenGL vertex
+arrays for triangles); new Plugin(Evaluate) to evaluate arbitrary
+expressions on post-processing views; generalized Plugin(Extract) to
+handle any combination of components; generalized "Coherence" to
+handle transfinite surface/volume attributes; plugin options can now
+be set in the option file (like all other options); added "undo"
+capability during geometry creation; rewrote the contour guessing
+routines so that entities can be selected in an arbitrary order; Mac
+users can now double click on geo/msh/pos files in the Finder to
+launch Gmsh; removed support for fltk 1.0; rewrote most of the code
+related to quadrangles; fixed 2d elliptic algorithm; removed all
+OpenGL display list code and options; many code cleanups;
 
 New in 1.52: new raster ("bitmap") PostScript/EPS/PDF output formats;
 new Plugin(Extract) to extract a given component from a
diff --git a/doc/gmsh.1 b/doc/gmsh.1
index 55abb91b51c8a893f59f5a4dd3496beefe3098b0..290d6e82b0df97f1535c0b8df24bbc93d0a20354 100644
--- a/doc/gmsh.1
+++ b/doc/gmsh.1
@@ -1,4 +1,4 @@
-.\" $Id: gmsh.1,v 1.52 2004-05-25 04:10:10 geuzaine Exp $
+.\" $Id: gmsh.1,v 1.53 2004-05-29 10:11:12 geuzaine Exp $
 .TH Gmsh 1 "14 June 2003" "Gmsh 1.45" "Gmsh Manual Pages"
 .UC 4
 .\" ********************************************************************
@@ -96,9 +96,6 @@ algorithm is selected.
 .\" ********************************************************************
 .SH POST-PROCESSING OPTIONS
 .TP 4
-.B \-dl
-enable OpenGL display lists.
-.TP 4
 .B \-noview
 hide all views at startup.
 .TP 4
diff --git a/doc/texinfo/command_line.texi b/doc/texinfo/command_line.texi
index 5152c8b8c428b3ecec9cc41a28393d883b585a18..03cf4c0f7e2a15aadd1e5690c93a9b58e625d7d9 100644
--- a/doc/texinfo/command_line.texi
+++ b/doc/texinfo/command_line.texi
@@ -51,8 +51,6 @@ display 2D mesh construction interactively
 @noindent Post-processing options:
 
 @ftable @code
-@item -dl
-enable display lists
 @item -noview
 hide all views on startup
 @item -link int
diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi
index 49a3f94f9acb7f52c2bd67216e4eca0229053a48..2751cd6cc42faa786612fa5fd4be9a52c84492d1 100644
--- a/doc/texinfo/opt_general.texi
+++ b/doc/texinfo/opt_general.texi
@@ -36,7 +36,7 @@ Saved in: @code{General.SessionFileName}
 
 @item General.TextEditor
 System command to launch a text editor@*
-Default value: @code{"emacs %s &"}@*
+Default value: @code{"open -e %s"}@*
 Saved in: @code{General.OptionsFileName}
 
 @item General.TmpFileName
@@ -46,7 +46,7 @@ Saved in: @code{General.SessionFileName}
 
 @item General.WebBrowser
 System command to launch a web browser@*
-Default value: @code{"if [[ $(ps -e|grep mozilla|grep -v grep) ]]; then mozilla -remote 'openurl(%s)' ; else mozilla %s ; fi &"}@*
+Default value: @code{"open %s"}@*
 Saved in: @code{General.OptionsFileName}
 
 @item General.AlphaBlending
diff --git a/doc/texinfo/opt_post.texi b/doc/texinfo/opt_post.texi
index b229e3dda8ca7240b56bdb43d384c915d5fe1e15..dbe60cd774bb49c943b2e13fd28ab7e28981dce4 100644
--- a/doc/texinfo/opt_post.texi
+++ b/doc/texinfo/opt_post.texi
@@ -9,11 +9,6 @@ Cycle through views instead of time steps in automatic animation mode@*
 Default value: @code{0}@*
 Saved in: @code{General.OptionsFileName}
 
-@item PostProcessing.DisplayLists
-Use OpenGL display lists for drawing post-processing views@*
-Default value: @code{0}@*
-Saved in: @code{General.OptionsFileName}
-
 @item PostProcessing.Link
 Link post-processing views (0=none, 1,2=changes in visible/all, 3,4=everything in visible/all)@*
 Default value: @code{0}@*
@@ -34,4 +29,9 @@ Apply (non-reversible) smoothing to post-processing view when merged@*
 Default value: @code{0}@*
 Saved in: @code{General.OptionsFileName}
 
+@item PostProcessing.VertexArrays
+Use OpenGL vertex arrays to draw triangles in post-processing views?@*
+Default value: @code{1}@*
+Saved in: @code{General.OptionsFileName}
+
 @end ftable