Index: orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h
===================================================================
--- orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h	(revision 4156)
+++ orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h	(revision 4157)
@@ -26,4 +26,5 @@
 #include <vector>
 #include <math.h>
+#include <SDL_image.h>
 
 using namespace std;
@@ -184,47 +185,26 @@
 {
 
-static createTexture(UINT textureArray[], LPSTR strFileName, int textureID)
-{
-	AUX_RGBImageRec *pBitmap = NULL;
+ public:
+  
+  static void createTexture(unsigned int textureArray[], char* strFileName, int textureID)
+    {
+      SDL_Surface *image = NULL;
+      
+      if(!strFileName)							       
+	return;
+
+      image = IMG_Load(strFileName);
+      if( !image)
+	PRINTF(0)("IMG_Load: %s\n", IMG_GetError());
 	
-	if(!strFileName)									// Return from the function if no file name was passed in
-		return;
-
-	pBitmap = auxDIBImageLoad(strFileName);				// Load the bitmap and store the data
-	
-	if(pBitmap == NULL)									// If we can't load the file, quit!
-		exit(0);
-
-	// Generate a texture with the associative texture ID stored in the array
-	glGenTextures(1, &textureArray[textureID]);
-
-	// This sets the alignment requirements for the start of each pixel row in memory.
-	glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
-	// Bind the texture to the texture arrays index and init the texture
-	glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
-
-	// Build Mipmaps (builds different versions of the picture for distances - looks better)
-	gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
-
-	// Lastly, we need to tell OpenGL the quality of our texture map.  GL_LINEAR_MIPMAP_LINEAR
-	// is the smoothest.  GL_LINEAR_MIPMAP_NEAREST is faster than GL_LINEAR_MIPMAP_LINEAR, 
-	// but looks blochy and pixilated.  Good for slower computers though.  
-		
-	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
-	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
-
-	// Now we need to free the bitmap data that we loaded since openGL stored it as a texture
-
-	if (pBitmap)										// If we loaded the bitmap
-	{
-		if (pBitmap->data)								// If there is texture data
-		{
-			free(pBitmap->data);						// Free the texture data, we don't need it anymore
-		}
-
-		free(pBitmap);									// Free the bitmap structure
-	}
-}
+      glGenTextures(1, &textureArray[textureID]);
+      glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+      glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
+      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
+      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
+      gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->w, image->h, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);	
+
+      SDL_FreeSurface(image);
+    }
 
 };
Index: orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
===================================================================
--- orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc	(revision 4156)
+++ orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc	(revision 4157)
@@ -146,4 +146,5 @@
   return true;
 }
+
 
 /**
@@ -191,4 +192,5 @@
 }
 
+
 /**
    \brief this function fills in the animation list for each animation by name and frame
@@ -239,4 +241,5 @@
     }
 }
+
 
 /**
Index: orxonox/branches/md2_loader/src/world_entities/test_entity.cc
===================================================================
--- orxonox/branches/md2_loader/src/world_entities/test_entity.cc	(revision 4156)
+++ orxonox/branches/md2_loader/src/world_entities/test_entity.cc	(revision 4157)
@@ -28,10 +28,21 @@
 TestEntity::TestEntity () : WorldEntity()
 {
- //This is for md2 test purposes only! if this is seen in the trunk: hit me :)
+  this->textureArray = new unsigned int[100];
+  memset(this->textureArray, 0, 100*sizeof(unsigned int));
+  
   MD2Loader* md2loader = new MD2Loader();
   this->model = new t3DModel;
   this->md2Model = new MD2Model();
 
-  md2loader->importMD2(model, "../data/models/tris.md2", "test.bmp");
+  md2loader->importMD2(this->model, "../data/models/tris.md2", "../data/models/tris.pcx");
+
+  for(int i = 0; i < this->model->numOfMaterials; i++)
+    {
+      if( strlen(this->model->materialList[i].strFile) > 0)
+	{
+	  Helper::createTexture(textureArray, this->model->materialList[i].strFile, i);
+	}
+      this->model->materialList[i].texureId = i;
+    }
 }
 
Index: orxonox/branches/md2_loader/src/world_entities/test_entity.h
===================================================================
--- orxonox/branches/md2_loader/src/world_entities/test_entity.h	(revision 4156)
+++ orxonox/branches/md2_loader/src/world_entities/test_entity.h	(revision 4157)
@@ -27,4 +27,7 @@
   t3DModel* model;
   MD2Model* md2Model;
+
+  unsigned int* textureArray;
+
 };
 
