Index: /branches/height_map/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- /branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6261)
+++ /branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6262)
@@ -75,18 +75,15 @@
 
 
-  glVertexPointer(3, GL_FLOAT, 0, this->vertices.getArray());
-  glNormalPointer(GL_FLOAT, 0, this->normals.getArray());
-  glTexCoordPointer(2, GL_FLOAT, 0, this->texCoords.getArray());
-  glColorPointer(3, GL_FLOAT, 0, this->colors.getArray());
-
-  for (GLuint i = 1; i < this->stripes.size(); ++i)
-    {
-      glDrawElements(GL_TRIANGLE_STRIP, this->stripes[i] - this->stripes[i-1], GL_UNSIGNED_BYTE, this->indices.getArray()+this->stripes[i-1]);
-//       glDrawRangeElements(GL_TRIANGLE_STRIP,
-// 			  this->stripes[i-1],
-// 			  this->stripes[i],
-// 			  this->indices.getCount(),
-// 			  GL_UNSIGNED_BYTE,
-// 			  this->indices.getArray());
+  glVertexPointer(3, GL_FLOAT, 0, &this->vertices[0]);
+  glNormalPointer(GL_FLOAT, 0, &this->normals[0]);
+  glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
+  glColorPointer(3, GL_FLOAT, 0, &this->colors[0]);
+
+  for (GLuint i = 1; ++i < this->stripes.size(); ++i)
+    {
+      glDrawElements( GL_TRIANGLES,
+                      this->stripes[i] - this->stripes[i-1],
+                      GL_UNSIGNED_BYTE,
+                      &this->indices[this->stripes[i-1]] );
     }
     glEnable(GL_LIGHTING);
@@ -102,5 +99,7 @@
 void VertexArrayModel::newStripe()
 {
-  this->stripes.push_back(this->indices.getCount());
+  // no stripes of size 0
+  if (this->stripes.empty() || this->indices.size() != this->stripes.back())
+    this->stripes.push_back(this->indices.size());
 }
 
@@ -114,5 +113,7 @@
 void VertexArrayModel::addVertex(float x, float y, float z)
 {
-  this->vertices.addEntry(x, y, z);
+  this->vertices.push_back(x);
+  this->vertices.push_back(y);
+  this->vertices.push_back(z);
   this->pModelInfo.numVertices++;
 }
@@ -129,5 +130,7 @@
 void VertexArrayModel::addNormal(float x, float y, float z)
 {
-  this->normals.addEntry(x, y, z);
+  this->normals.push_back(x);
+  this->normals.push_back(y);
+  this->normals.push_back(z);
   this->pModelInfo.numNormals++;
 }
@@ -143,6 +146,6 @@
 void VertexArrayModel::addTexCoor(float u, float v)
 {
-  this->texCoords.addEntry(u);
-  this->texCoords.addEntry(v);
+  this->texCoords.push_back(u);
+  this->texCoords.push_back(v);
   this->pModelInfo.numTexCoor++;
 }
@@ -156,5 +159,7 @@
 void VertexArrayModel::addColor(float r, float g, float b)
 {
-  this->colors.addEntry(r, g, b);
+  this->colors.push_back(r);
+  this->colors.push_back(g);
+  this->colors.push_back(b);
   // FIXME
 }
@@ -168,5 +173,5 @@
 void VertexArrayModel::addIndice(GLubyte indice)
 {
-  this->indices.addEntry(indice);
+  this->indices.push_back(indice);
 }
 
@@ -178,17 +183,5 @@
 {
   // finalize the Arrays
-  this->vertices.finalizeArray();
-  this->texCoords.finalizeArray();
-  this->normals.finalizeArray();
-  this->colors.finalizeArray();
-  this->indices.finalizeArray();
-
   this->newStripe();
-
-  for (int i = 0 ; i < this->stripes.size(); i++)
-  {
-    printf("== %d ==\n", stripes[i]);
-
-  }
 
   /*
@@ -213,5 +206,5 @@
 void VertexArrayModel::planeModel()
 {
-  unsigned int sizeX = 20, sizeY = 10;
+  unsigned int sizeX = 20, sizeY = 20;
 
   unsigned int i, j;
@@ -220,6 +213,6 @@
       for (j = 0; j < sizeX; j++)
         {
-          this->addVertex((float)i - sizeY/2.0, sin(-(float)i/(float)sizeY*5.0) * cos((float)j/(float)sizeX*5.0) * 10.0 , (float)(j) - sizeX/2.0);
-          this->addNormal((float)i/(float)sizeY, 1, (float)j/(float)sizeX);
+          this->addVertex((float)i - (float)sizeY/2.0, sin((float)i/(float)sizeY*5.0)*cos((float)j/(float)sizeX*5.0)*5.0, (float)j - (float)sizeX/2.0);
+          this->addNormal(0.0, 1, 0.0);
           this->addTexCoor((float)i/(float)sizeY, (float)j/(float)sizeY);
           this->addColor((float)i/20.0, 0.0, (float)j/20.0);
@@ -231,9 +224,85 @@
     for (j = 0; j < sizeX; j++)
     {
-      this->addIndice(sizeX*i + j);
-      this->addIndice(sizeX*(i+1) + j);
-    }
-    if (i < sizeY -1 )
-      this->newStripe();
-  }
-}
+      this->addIndice(sizeY*i + j);
+      this->addIndice(sizeY*(i+1) + j);
+    }
+    this->debug();
+    this->newStripe();
+  }
+}
+
+#include <cmath>
+
+void VertexArrayModel::spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop)
+{
+  for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+  {
+    float theta = 0;
+    float phi = loopSegmentNumber * 2 * PI / segmentsPerLoop;
+    float sinTheta = std::sin(theta);
+    float sinPhi = std::sin(phi);
+    float cosTheta = std::cos(theta);
+    float cosPhi = std::cos(phi);
+    this->addVertex(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+    this->addNormal(1,1,1);
+    this->addTexCoor(0,0);
+    this->addColor(.125,.436,.246);
+  }
+  for (unsigned int loopNumber = 0; loopNumber <= loops; ++loopNumber)
+  {
+    for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+    {
+      float theta = (loopNumber * PI / loops) + ((PI * loopSegmentNumber) / (segmentsPerLoop * loops));
+      if (loopNumber == loops)
+      {
+        theta = PI;
+      }
+      float phi = loopSegmentNumber * 2 * PI / segmentsPerLoop;
+      float sinTheta = std::sin(theta);
+      float sinPhi = std::sin(phi);
+      float cosTheta = std::cos(theta);
+      float cosPhi = std::cos(phi);
+      this->addVertex(radius * cosPhi * sinTheta, radius * sinPhi * sinTheta, radius * cosTheta);
+      this->addNormal(1,1,1);
+      this->addTexCoor(0,0);
+      this->addColor(.125,.436,.246);
+
+    }
+  }
+  for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+  {
+    this->addIndice(loopSegmentNumber);
+    this->addIndice(segmentsPerLoop + loopSegmentNumber);
+  }
+  for (unsigned int loopNumber = 0; loopNumber < loops; ++loopNumber)
+  {
+    for (unsigned int loopSegmentNumber = 0; loopSegmentNumber < segmentsPerLoop; ++loopSegmentNumber)
+    {
+      this->addIndice( ((loopNumber + 1) * segmentsPerLoop) + loopSegmentNumber);
+      this->addIndice( ((loopNumber + 2) * segmentsPerLoop) + loopSegmentNumber);
+    }
+  }
+}
+
+
+
+void VertexArrayModel::debug() const
+{
+  PRINT(0)("VertexArrayModel (%s): debug\n", this->getName());
+  PRINT(0)("Stripes: %d; Indices: %d; Vertices: %d; Normals %d; TextCoords %d; Colors %d\n",
+            this->stripes.size(),
+            this->indices.size(),
+            this->vertices.size()/3,
+            this->normals.size()/3,
+            this->texCoords.size()/2,
+            this->colors.size() )/3;
+  for (GLuint i = 1; i < this->stripes.size(); ++i)
+  {
+    PRINT(0)("Stripe-%d ::", i);
+    for (GLuint j = this->stripes[i-1] ; j < this->stripes[i]; j++)
+    {
+      PRINT(0)("%d->", this->indices[j]);
+    }
+    PRINT(0)("\n");
+  }
+}
Index: /branches/height_map/src/lib/graphics/importer/vertex_array_model.h
===================================================================
--- /branches/height_map/src/lib/graphics/importer/vertex_array_model.h	(revision 6261)
+++ /branches/height_map/src/lib/graphics/importer/vertex_array_model.h	(revision 6262)
@@ -47,4 +47,7 @@
   //
   void planeModel();
+  void spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop);
+
+  void debug() const;
 
  private:
@@ -54,10 +57,10 @@
   bool                       bFinalized;       //!< Sets the Object to be finalized.
 
-  tArray<GLfloat>            vertices;        //!< The Array that handles the Vertices.
-  tArray<GLfloat>            normals;         //!< The Array that handles the Normals.
-  tArray<GLfloat>            texCoords;       //!< The Array that handles the VertexTextureCoordinates.
-  tArray<GLfloat>            colors;          //!< The Array that handles Colors.
+  std::vector<GLfloat>       vertices;        //!< The Array that handles the Vertices.
+  std::vector<GLfloat>       normals;         //!< The Array that handles the Normals.
+  std::vector<GLfloat>       texCoords;       //!< The Array that handles the VertexTextureCoordinates.
+  std::vector<GLfloat>       colors;          //!< The Array that handles Colors.
 
-  tArray<GLubyte>            indices;         //!< The Array that tells us what Vertex is connected to which other one.
+  std::vector<GLubyte>       indices;         //!< The Array that tells us what Vertex is connected to which other one.
 
   std::vector<GLuint>        stripes;         //!< A lsit of Stripes of this Model.
