diff --git a/Common/VertexArray.cpp b/Common/VertexArray.cpp
index 02f0a806b25a82956a671ccf4d694ffcf2054fd0..842763b28835dae05f7dcc488769363dffca46e3 100644
--- a/Common/VertexArray.cpp
+++ b/Common/VertexArray.cpp
@@ -1,4 +1,4 @@
-// $Id: VertexArray.cpp,v 1.27 2007-09-22 22:56:37 geuzaine Exp $
+// $Id: VertexArray.cpp,v 1.28 2007-09-24 14:59:01 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -35,22 +35,27 @@ VertexArray::VertexArray(int numVerticesPerElement, int numElements)
   _colors.reserve(nb * 4);
 }
 
-void VertexArray::add(float x, float y, float z, float n0, float n1, float n2,
-		      unsigned int col, MElement *ele)
+void VertexArray::addVertex(float x, float y, float z)
 {
   _vertices.push_back(x);
   _vertices.push_back(y);
   _vertices.push_back(z);
+}
 
+void VertexArray::addNormal(float nx, float ny, float nz)
+{
   // storing the normals as bytes hurts rendering performance, but it
   // significantly reduces the memory footprint
-  char c0 = float2char(n0);
-  char c1 = float2char(n1);
-  char c2 = float2char(n2);
-  _normals.push_back(c0);
-  _normals.push_back(c1);
-  _normals.push_back(c2);
+  char cx = float2char(nx);
+  char cy = float2char(ny);
+  char cz = float2char(nz);
+  _normals.push_back(cx);
+  _normals.push_back(cy);
+  _normals.push_back(cz);
+}
 
+void VertexArray::addColor(unsigned int col)
+{
   unsigned char r = CTX.UNPACK_RED(col);
   unsigned char g = CTX.UNPACK_GREEN(col);
   unsigned char b = CTX.UNPACK_BLUE(col);
@@ -59,7 +64,10 @@ void VertexArray::add(float x, float y, float z, float n0, float n1, float n2,
   _colors.push_back(g);
   _colors.push_back(b);
   _colors.push_back(a);
+}
 
+void VertexArray::addElement(MElement *ele)
+{
   if(ele && CTX.pick_elements) _elements.push_back(ele);
 }
 
@@ -87,18 +95,26 @@ void VertexArray::add(double *x, double *y, double *z, SVector3 *n,
     _barycenters.insert(pc);
   }
   
-  for(int i = 0; i < npe; i++)
-    add(x[i], y[i], z[i], n[i].x(), n[i].y(), n[i].z(), col[i], ele);
+  for(int i = 0; i < npe; i++){
+    addVertex(x[i], y[i], z[i]);
+    if(n) addNormal(n[i].x(), n[i].y(), n[i].z());
+    if(col) addColor(col[i]);
+    addElement(ele);
+  }
 }
 
 void VertexArray::finalize()
 {
   if(_data3.size()){
     std::set<ElementData<3>, ElementDataLessThan<3> >::iterator it = _data3.begin();
-    for(; it != _data3.end(); it++)
-      for(int i = 0; i < 3; i++)
-	add(it->x(i), it->y(i), it->z(i), it->nx(i), it->ny(i), it->nz(i), 
-	    it->col(i), it->ele());
+    for(; it != _data3.end(); it++){
+      for(int i = 0; i < 3; i++){
+	addVertex(it->x(i), it->y(i), it->z(i));
+	addNormal(it->nx(i), it->ny(i), it->nz(i));
+	addColor(it->col(i));
+	addElement(it->ele());
+      }
+    }
     _data3.clear();
   }
   _barycenters.clear();
diff --git a/Common/VertexArray.h b/Common/VertexArray.h
index 27a4e21bb9e8a86204532549cb0faed6af90df49..1c742b2808d0968829186e9540dae10150112ba8 100644
--- a/Common/VertexArray.h
+++ b/Common/VertexArray.h
@@ -43,10 +43,17 @@ class ElementData {
       _x[i] = x[i];
       _y[i] = y[i];
       _z[i] = z[i];
-      _nx[i] = n[i].x();
-      _ny[i] = n[i].y();
-      _nz[i] = n[i].z();
-      _col[i] = col[i];
+      if(n){
+	_nx[i] = n[i].x();
+	_ny[i] = n[i].y();
+	_nz[i] = n[i].z();
+      }
+      else
+	_nx[i] = _ny[i] = _nz[i] = 0.;
+      if(col)
+	_col[i] = col[i];
+      else
+	_col[i] = 0;
     }
     _ele = ele;
   }
@@ -141,10 +148,12 @@ class VertexArray{
   unsigned char *getColorArray(int i=0){ return &_colors[i]; }
   // returns a pointer to the raw element array
   MElement **getElementPointerArray(int i=0){ return &_elements[i]; }
-  // adds a vertex in the arrays
-  void add(float x, float y, float z, float n0, float n1, float n2, 
-	   unsigned int col, MElement *ele=0);
-  // add an element in the arrays (if unique is set, only add the
+  // adds stuff in the arrays
+  void addVertex(float x, float y, float z);
+  void addNormal(float nx, float ny, float nz);
+  void addColor(unsigned int col);
+  void addElement(MElement *ele);
+  // add element data in the arrays (if unique is set, only add the
   // element if another one with the same barycenter is not already
   // present)
   void add(double *x, double *y, double *z, SVector3 *n, unsigned int *col,