Index: /orxonox/trunk/src/glmenu/glmenu_imagescreen.cc
===================================================================
--- /orxonox/trunk/src/glmenu/glmenu_imagescreen.cc	(revision 4135)
+++ /orxonox/trunk/src/glmenu/glmenu_imagescreen.cc	(revision 4136)
@@ -97,5 +97,5 @@
 {
   delete this->backMat;
-  delete barMat;
+  delete this->barMat;
 }
 
Index: /orxonox/trunk/src/lib/graphics/importer/material.cc
===================================================================
--- /orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 4135)
+++ /orxonox/trunk/src/lib/graphics/importer/material.cc	(revision 4136)
@@ -45,12 +45,7 @@
   this->setTransparency(1.0);
 
-
   this->diffuseTexture = NULL;
   this->ambientTexture = NULL;
   this->specularTexture = NULL;
-
-  this->diffuseTextureSet = false;
-  this->ambientTextureSet = false;
-  this->specularTextureSet = false;
 
   this->setName(mtlName);
@@ -107,5 +102,5 @@
     glShadeModel(GL_SMOOTH);
 
-  if (this->diffuseTextureSet)
+  if (this->diffuseTexture)
     {
       glEnable(GL_TEXTURE_2D);
@@ -300,10 +295,8 @@
 {
   PRINTF(4)("setting Diffuse Map %s\n", dMap);
-  //    diffuseTexture = new Texture();
-  //    this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
 
   //! \todo check if RESOURCE MANAGER is availiable
   //! \todo Textures from .mtl-file need special care.
-  this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
+  this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE);
 }
 
Index: /orxonox/trunk/src/lib/graphics/importer/material.h
===================================================================
--- /orxonox/trunk/src/lib/graphics/importer/material.h	(revision 4135)
+++ /orxonox/trunk/src/lib/graphics/importer/material.h	(revision 4136)
@@ -67,9 +67,4 @@
   Texture* ambientTexture; //!< The ambient texture of the Material.
   Texture* specularTexture;//!< The specular texture of the Material.
-  
-  bool diffuseTextureSet; //!< Chekcs if the diffuse texture is Set.
-  bool ambientTextureSet; //!< Chekcs if the ambient texture is Set.
-  bool specularTextureSet;//!< Chekcs if the specular texture is Set.
-
 };
 #endif
Index: /orxonox/trunk/src/orxonox.cc
===================================================================
--- /orxonox/trunk/src/orxonox.cc	(revision 4135)
+++ /orxonox/trunk/src/orxonox.cc	(revision 4136)
@@ -139,19 +139,5 @@
   
   GraphicsEngine::getInstance();
-
-  /*
- int i;
-  for(i = 1; i < this->argc; ++i)
-    {
-      if (!strncmp (this->argv[i], "-r", 2))
-	{
-	  char* tmp = strchr (argv[i], 'x');
-	  //	  GraphicsEngine::getInstance()->setResolution(atoi(argv[i]), atoi(tmp+1), 24);
-	}
-      else if (!strncmp(this->argv[i], "--resolution=", 13))
-	{
-	}
-    }
-  */
+    
   return 0;
 }
Index: /orxonox/trunk/src/story_entities/world.cc
===================================================================
--- /orxonox/trunk/src/story_entities/world.cc	(revision 4135)
+++ /orxonox/trunk/src/story_entities/world.cc	(revision 4136)
@@ -197,8 +197,4 @@
   cn->reset();
 
-  ResourceManager::getInstance()->debug();
-  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
-  ResourceManager::getInstance()->debug();
-
   delete WorldInterface::getInstance();
 
@@ -209,10 +205,9 @@
   TextEngine::getInstance()->flush();
 
-  AnimationPlayer::getInstance()->debug();
   delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
   //delete garbagecollecor
   //delete animator
 
-
+  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
 }
 
@@ -844,5 +839,4 @@
   this->glmis = new GLMenuImageScreen();
   this->glmis->init();
-  glmis->setBackgroundImage("pictures/load_screen.jpg");
   this->glmis->setMaximum(8);
   //  this->glmis->draw();
Index: /orxonox/trunk/src/world_entities/skybox.cc
===================================================================
--- /orxonox/trunk/src/world_entities/skybox.cc	(revision 4135)
+++ /orxonox/trunk/src/world_entities/skybox.cc	(revision 4136)
@@ -66,5 +66,5 @@
       PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n");
     }
-  if( this->model == NULL)
+  if( this->skyModel == NULL)
     {
       PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
@@ -76,6 +76,7 @@
 {
   this->setClassName("SkyBox");
+  this->skyModel = NULL;
   this->material = new Material*[6];
-  for (int i = 0; i <6; i++) 
+  for (int i = 0; i < 6; i++) 
     {
       this->material[i] = new Material();
@@ -100,5 +101,5 @@
 SkyBox::~SkyBox()
 {
-  PRINTF(5)("Deleting the SkyBox\n");
+  PRINTF(5)("Deleting SkyBox\n");
   for (int i = 0; i < 6; i++)
     delete this->material[i];
@@ -179,5 +180,5 @@
   glTranslatef(r.x, r.y, r.z);
 
-  this->model->draw();
+  this->skyModel->draw();
 
   glPopMatrix();
@@ -192,42 +193,42 @@
 void SkyBox::rebuild()
 {
-  if (this->model)
-    delete model;
-  model = new Model();
-
-  model->addVertex (-0.5*size, -0.5*size, 0.5*size);  
-  model->addVertex (0.5*size, -0.5*size, 0.5*size);
-  model->addVertex (-0.5*size, 0.5*size, 0.5*size);
-  model->addVertex (0.5*size, 0.5*size, 0.5*size);
-  model->addVertex (-0.5*size, 0.5*size, -0.5*size);
-  model->addVertex (0.5*size, 0.5*size, -0.5*size);
-  model->addVertex (-0.5*size, -0.5*size, -0.5*size);
-  model->addVertex (0.5*size, -0.5*size, -0.5*size);
-
-  model->addVertexTexture (0.0, 0.0);
-  model->addVertexTexture (1.0, 0.0);
-  model->addVertexTexture (1.0, 1.0);
-  model->addVertexTexture (0.0, 1.0);
-
-  model->addVertexNormal (0.0, 0.0, 1.0);
-  model->addVertexNormal (0.0, 1.0, 0.0);
-  model->addVertexNormal (0.0, 0.0, -1.0);
-  model->addVertexNormal (0.0, -1.0, 0.0);
-  model->addVertexNormal (1.0, 0.0, 0.0);
-  model->addVertexNormal (-1.0, 0.0, 0.0);
-
-  model->setMaterial(material[0]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top
-  model->setMaterial(material[1]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom
-  model->setMaterial(material[2]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left
-  model->setMaterial(material[3]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right
-  model->setMaterial(material[4]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
-  model->setMaterial(material[5]);
-  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
+  if (this->skyModel)
+    delete skyModel;
+  skyModel = new Model();
+
+  this->skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size);  
+  this->skyModel->addVertex (0.5*size, -0.5*size, 0.5*size);
+  this->skyModel->addVertex (-0.5*size, 0.5*size, 0.5*size);
+  this->skyModel->addVertex (0.5*size, 0.5*size, 0.5*size);
+  this->skyModel->addVertex (-0.5*size, 0.5*size, -0.5*size);
+  this->skyModel->addVertex (0.5*size, 0.5*size, -0.5*size);
+  this->skyModel->addVertex (-0.5*size, -0.5*size, -0.5*size);
+  this->skyModel->addVertex (0.5*size, -0.5*size, -0.5*size);
+
+  this->skyModel->addVertexTexture (0.0, 0.0);
+  this->skyModel->addVertexTexture (1.0, 0.0);
+  this->skyModel->addVertexTexture (1.0, 1.0);
+  this->skyModel->addVertexTexture (0.0, 1.0);
+
+  this->skyModel->addVertexNormal (0.0, 0.0, 1.0);
+  this->skyModel->addVertexNormal (0.0, 1.0, 0.0);
+  this->skyModel->addVertexNormal (0.0, 0.0, -1.0);
+  this->skyModel->addVertexNormal (0.0, -1.0, 0.0);
+  this->skyModel->addVertexNormal (1.0, 0.0, 0.0);
+  this->skyModel->addVertexNormal (-1.0, 0.0, 0.0);
+
+  this->skyModel->setMaterial(material[0]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top
+  this->skyModel->setMaterial(material[1]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom
+  this->skyModel->setMaterial(material[2]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left
+  this->skyModel->setMaterial(material[3]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right
+  this->skyModel->setMaterial(material[4]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
+  this->skyModel->setMaterial(material[5]);
+  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
   
-  model->finalize();
-}
+  this->skyModel->finalize();
+}
Index: /orxonox/trunk/src/world_entities/skybox.h
===================================================================
--- /orxonox/trunk/src/world_entities/skybox.h	(revision 4135)
+++ /orxonox/trunk/src/world_entities/skybox.h	(revision 4136)
@@ -39,4 +39,5 @@
   void rebuild();
 
+  Model* skyModel;        //!< A Model for the Sky. This must not be the same as the Model from WorldEntity, because it is not alocated through the ResourceManager.
   Material **material;    //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
   float size;             //!< Size of the SkyBox. This should match the frustum maximum range.
Index: /orxonox/trunk/src/world_entities/terrain.cc
===================================================================
--- /orxonox/trunk/src/world_entities/terrain.cc	(revision 4135)
+++ /orxonox/trunk/src/world_entities/terrain.cc	(revision 4136)
@@ -77,7 +77,7 @@
 void Terrain::init(void)
 {
-   this->setClassName ("Terrain");
-
-   this->objectList = 0;
+  this->setClassName ("Terrain");
+  
+  this->objectList = 0;
 }
 
@@ -98,9 +98,8 @@
   glMultMatrixf((float*)matrix);
 
-  if (objectList)
-    glCallList(objectList);
-  else if (model)
-    model->draw();
-  //  this->model->draw();
+  if (this->objectList)
+    glCallList(this->objectList);
+  else if (this->model)
+    this->model->draw();
   glPopMatrix();
 }
