Index: /orxonox/branches/importer/importer/framework.cc
===================================================================
--- /orxonox/branches/importer/importer/framework.cc	(revision 2764)
+++ /orxonox/branches/importer/importer/framework.cc	(revision 2765)
@@ -9,5 +9,5 @@
 void DrawGLScene()
 {
-  rotator +=.0001;
+  rotator +=.01;
   
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -17,9 +17,7 @@
   glLoadIdentity();	
   gluPerspective(45.0f,500/375,0.1f,100.0f);
-  gluLookAt (10*sin(rotator),5,10*cos(rotator), 0,0,0, 0,1,0);
-
+  gluLookAt (10*sin(rotator),15,10*cos(rotator), 0,0,0, 0,1,0);
+  
   obj->draw();
-
-  
 
   SDL_GL_SwapBuffers(); // Swap the buffers
Index: /orxonox/branches/importer/importer/object.cc
===================================================================
--- /orxonox/branches/importer/importer/object.cc	(revision 2764)
+++ /orxonox/branches/importer/importer/object.cc	(revision 2765)
@@ -1,20 +1,18 @@
 #include "object.h"
-
 Object::Object ()
 {
-  this->readFromObjFile ("reaphigh.obj");
-    
+  this->readFromObjFile ("sphere.obj");
+
+  listNumber = glGenLists(1);
+  glNewList (listNumber, GL_COMPILE);
+
   glEnableClientState (GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertices->getArray());
   
-  listNumber = glGenLists(1);
-  glNewList (listNumber, GL_COMPILE);
-
   glColor3f(1.0,0,0);
   glBegin(GL_QUADS);
-  
+  printf ("face-count %i\n", faces->getCount());
   for (int i=0; i<=faces->getCount();++i)
     {
-      printf ("%i, %i\n", i, (int) faces->getArray()[i]);
       glArrayElement((int)faces->getArray()[i] -1);
     }
@@ -35,4 +33,66 @@
 bool Object::readFromObjFile (char* fileName)
 {
+  OBJ_FILE = new ifstream (fileName);
+  char Buffer[500];
+  vertices = new Array();
+  faces = new Array();
+  while(!OBJ_FILE->eof())
+    {
+      OBJ_FILE->getline(Buffer, 500);
+      //      printf("%s\n", Buffer);
+      
+
+      // case vertice
+      if (!strncmp(Buffer, "v ", 2))
+	{
+	  char subbuffer1[10];
+	  char subbuffer2[10];
+	  char subbuffer3[10];
+	  sscanf (Buffer, "v %s %s %s", subbuffer1, subbuffer2, subbuffer3);
+	  vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
+	}
+
+      // case face
+      else if (!strncmp(Buffer, "f ", 2))
+	{
+	  char subbuffer1[10];
+	  char subbuffer2[10];
+	  char subbuffer3[10];
+	  char subbuffer4[10] ="";
+	  sscanf (Buffer, "f %s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+	  //	  vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
+	  if (!strcmp(subbuffer4, ""))
+	    {
+	      printf ("triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3);
+	      faces->addEntry(atof(subbuffer1));
+	      faces->addEntry(atof(subbuffer2));
+	      faces->addEntry(atof(subbuffer3));
+	    }
+	  else
+	    {
+	      printf ("quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
+	      faces->addEntry(atof(subbuffer1));
+	      faces->addEntry(atof(subbuffer2));
+	      faces->addEntry(atof(subbuffer3));
+	      faces->addEntry(atof(subbuffer4));
+
+	    }
+	}
+
+      // case vt
+      else if (!strncmp(Buffer, "vt ", 2))
+      {
+	//	printf ("verticeTangent found");
+      }
+	  
+
+    }
+  
+
+  
+  OBJ_FILE->close();
+  
+  /*
+
   if ( (OBJ_FILE = fopen (fileName, "r")) == NULL)
     {
@@ -43,40 +103,48 @@
     {
       char Buffer[100];
-      vertices = new Array();
-      faces = new Array();
-      char lastWas = '0';
-	
-      while (fscanf (OBJ_FILE, "%s", Buffer) != EOF)
+      char optionIs = '0';
+      char optionWas = '0';
+      int entryCount = 0; //counts how many inputs an option has.
+      int lastEntryCount = 0;
+      while (fscanf (OBJ_FILE, "%c10", Buffer) != EOF)
 	{
-	  
+	  printf("%s", Buffer);
+
 	  // case we read it is a vertex
 	  if (!strcmp (Buffer, "v"))
 	    {
-	      lastWas = 'v';
+	      optionIs = 'v';
+	      entryCount = 0;
 	    }
 	  // case we read a Face
 	  else if (!strcmp (Buffer, "f"))
 	    {  
-	      lastWas = 'f';
+	      optionIs = 'f';
+	      entryCount = 0;
 	    }
 	  else if (!strcmp (Buffer, "vn"))
 	    {
-	      lastWas = 'n';
+	      optionIs = 'n';
+	      entryCount = 0;
 	    }
 	  else if (!strcmp (Buffer, "vt"))
 	    {
-	      lastWas = 't';
+	      optionIs = 't';
+	      entryCount = 0;
 	    }
 	  else if (!strcmp (Buffer,"s"))
 	    {
-	      lastWas = '0';
+	      optionIs = '0';
+	      entryCount = 0;
 	    }
 	  else if (!strncmp (Buffer,"u", 1))
 	    {
-	      lastWas = '0';
+	      optionIs = '0';
+	      entryCount = 0;
 	    }
 	  else if (!strcmp (Buffer,"g"))
 	    {
-	      lastWas = '0';
+	      optionIs = '0';
+	      entryCount = 0;
 	    }
 
@@ -85,25 +153,43 @@
 	  else
 	    {
-	      if (lastWas == 'v')
+	      if (optionIs == 'v')
 		{
 		  vertices->addEntry(atof(Buffer));
-		  printf ("v: %s\n", Buffer);
+		  ++entryCount;
+
+		  //		  printf ("v: %s\n", Buffer);
 		}
-	      else if (lastWas == 'f')
+	      else if (optionIs == 'f')
 		{
 		  char* pointTo;
 		  pointTo = strstr (Buffer, "/");
 		  pointTo[0] = '\0';
-		  printf ("f: %s\n", Buffer);
+		  //		  printf ("f: %s\n", Buffer);
 		  faces->addEntry(atof(Buffer));
+		  ++entryCount;
 		}
 	      
 	    }
+
+	  if (entryCount == 0 && (optionWas == 'f'))
+	    {
+	      if (lastEntryCount == 3)
+		printf ("triang\n");
+	      else if (lastEntryCount == 4)
+		printf ("quads\n");
+		     
+	    }
+
+	  lastEntryCount = entryCount;
+	  optionWas = optionIs;
+
 	}
       vertices->finalizeArray();
       faces->finalizeArray();
       fclose (OBJ_FILE);
-      printf("test\n");
       return true;
     }
+  */
 }
+
+//caseChange (char optionIs, int entryCount)
Index: /orxonox/branches/importer/importer/object.h
===================================================================
--- /orxonox/branches/importer/importer/object.h	(revision 2764)
+++ /orxonox/branches/importer/importer/object.h	(revision 2765)
@@ -1,4 +1,5 @@
 #include "windowHandler.h"
 #include "array.h"
+#include <fstream.h>
 
 class Object
@@ -20,6 +21,6 @@
   Array* faces;
 
-  FILE* OBJ_FILE;
-  FILE* MTL_FILE;
+  ifstream* OBJ_FILE;
+  ifstream* MTL_FILE;
   
 
