Index: orxonox/trunk/src/object.cc
===================================================================
--- orxonox/trunk/src/object.cc	(revision 2866)
+++ orxonox/trunk/src/object.cc	(revision 2935)
@@ -297,8 +297,8 @@
     }
   objFileName = fileName;
-  char Buffer[500];
+  char Buffer[10000];
   while(!OBJ_FILE->eof())
     {
-      OBJ_FILE->getline(Buffer, 500);
+      OBJ_FILE->getline(Buffer, 10000);
       if (verbose >=4)
 	printf ("Read input line: %s\n",Buffer);
@@ -379,7 +379,7 @@
     {
       currentGroup->vertices->finalizeArray();
-      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
+      //      glVertexPointer(3, GL_FLOAT, 0, currentGroup->vertices->getArray());
       currentGroup->normals->finalizeArray();
-      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
+      //      glNormalPointer(GL_FLOAT, 0, currentGroup->normals->getArray());
       currentGroup->vTexture->finalizeArray();
     }
@@ -387,10 +387,29 @@
   readingVertices = false;
   currentGroup->faceCount++;
-  char subbuffer1[20];
-  char subbuffer2[20];
-  char subbuffer3[20];
-  char subbuffer4[20] ="";
-  sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
-  if (!strcmp(subbuffer4, ""))
+
+  int elemCount = 0;
+  
+  FaceElement* firstElem = new FaceElement;
+  FaceElement* tmpElem = firstElem;
+
+  
+  while(strcmp (faceString, "\0"))
+    {
+      if (elemCount>0)
+	  tmpElem = tmpElem->next = new FaceElement;
+      tmpElem->next = NULL;
+
+
+      sscanf (faceString, "%s", tmpElem->value);
+      faceString += strlen(tmpElem->value);
+      if (strcmp (faceString, "\0"))
+	faceString++;
+      elemCount++;
+
+
+    }
+  
+  
+  if (elemCount == 3)
     {
       if (currentGroup->faceMode != 3)
@@ -403,11 +422,8 @@
       currentGroup->faceMode = 3;
       if (verbose >=3)
-	printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
-      addGLElement(subbuffer1);
-      addGLElement(subbuffer2);
-      addGLElement(subbuffer3);
-      return true;
-    }
-  else
+	printf ("found triag.\n");
+    }
+  
+  else if (elemCount == 4)
     {
       if (currentGroup->faceMode != 4)
@@ -419,11 +435,25 @@
       currentGroup->faceMode = 4;
       if (verbose >=3 )
-	printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
-      addGLElement(subbuffer1);
-      addGLElement(subbuffer2);
-      addGLElement(subbuffer3);
-      addGLElement(subbuffer4);
-      return true;
-    }
+	printf ("found quad.\n");
+    }
+  
+  else if (elemCount > 4)
+    {
+      if (currentGroup->faceMode != -1)
+	glEnd();
+      glBegin(GL_POLYGON);
+      if (verbose >=3)
+	printf ("Polygon with %i faces found.", elemCount);
+      currentGroup->faceMode = elemCount;
+    }
+
+  tmpElem = firstElem;
+  while (tmpElem != NULL)
+    {
+      //      printf ("%s\n", tmpElem->value);
+      addGLElement(tmpElem->value);
+      tmpElem = tmpElem->next;
+    }
+
 }
 
@@ -444,18 +474,20 @@
 
   char* texture;
-  texture = strstr (vertex, "/");
-  texture[0] = '\0';
-  texture ++;
-  if (verbose>=3)
-    printf ("includeing texture #%i, and mapping it to group texture #%i, textureArray has %i entries.\n", atoi(texture), (atoi(texture)-1 - currentGroup->firstVertexTexture)*3, currentGroup->vTexture->getCount());
-  glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
-
-  char* normal;
-  if ((normal = strstr (texture, "/")) !=NULL)
-    {
-      normal[0] = '\0';
-      normal ++;
-      //glArrayElement(atoi(vertex)-1);
-      glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
+  if ((texture = strstr (vertex, "/")) != NULL)
+    {
+      texture[0] = '\0';
+      texture ++;
+      if (verbose>=3)
+	printf ("includeing texture #%i, and mapping it to group texture #%i, textureArray has %i entries.\n", atoi(texture), (atoi(texture)-1 - currentGroup->firstVertexTexture)*3, currentGroup->vTexture->getCount());
+      glTexCoord2fv(currentGroup->vTexture->getArray()+(atoi(texture)-1 - currentGroup->firstVertexTexture)*2);
+
+      char* normal;
+      if ((normal = strstr (texture, "/")) !=NULL)
+	{
+	  normal[0] = '\0';
+	  normal ++;
+	  //glArrayElement(atoi(vertex)-1);
+	  glNormal3fv(currentGroup->normals->getArray() +(atoi(normal)-1 - currentGroup->firstNormal)*3);
+	}
     }
   if (verbose>=3)
Index: orxonox/trunk/src/object.h
===================================================================
--- orxonox/trunk/src/object.h	(revision 2866)
+++ orxonox/trunk/src/object.h	(revision 2935)
@@ -18,4 +18,10 @@
 extern int verbose; //!< fill be removed and added again as a verbose-class
 
+
+struct FaceElement
+{
+  char value[20];
+  FaceElement* next;
+};
 
 //! Class that handles 3D-Objects. it can also read them in and display them.
