Index: trunk/src/world_entities/environments/water.cc
===================================================================
--- trunk/src/world_entities/environments/water.cc	(revision 6852)
+++ trunk/src/world_entities/environments/water.cc	(revision 6860)
@@ -183,15 +183,17 @@
     glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
 
-    if (State::getSkyBox())
-    {
-      glBindTexture(GL_TEXTURE_2D, State::getSkyBox()->getTexture(SKY_RIGHT));
-      glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-      glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-      glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-      glEnable(GL_TEXTURE_GEN_S);
-      glEnable(GL_TEXTURE_GEN_T);
-    }
-    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+//     if (State::getSkyBox())
+//     {
+//       glBindTexture(GL_TEXTURE_2D, State::getSkyBox()->getTexture(SKY_RIGHT));
+//       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+//
+//       glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+//       glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+//       glEnable(GL_TEXTURE_GEN_S);
+//       glEnable(GL_TEXTURE_GEN_T);
+//     }
+//     glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+    SkyBox::enableCubeMap();
     this->grid->draw();
     // this->waterShader->activateShader();
@@ -199,7 +201,7 @@
     //Shader::deactivateShader();
 
-    //SkyBox::disableCubeMap();
-    glDisable(GL_TEXTURE_GEN_S);
-    glDisable(GL_TEXTURE_GEN_T);
+    SkyBox::disableCubeMap();
+//     glDisable(GL_TEXTURE_GEN_S);
+//     glDisable(GL_TEXTURE_GEN_T);
 
     glPopMatrix();
Index: trunk/src/world_entities/skybox.cc
===================================================================
--- trunk/src/world_entities/skybox.cc	(revision 6852)
+++ trunk/src/world_entities/skybox.cc	(revision 6860)
@@ -168,22 +168,26 @@
 }
 
+
+#include "resource_manager.h"
+
 void SkyBox::loadCubeMapTextures(const char* top, const char* bottom, const char* left,
                                   const char* right, const char* front, const char* back)
 {
-  this->cubeTexture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
-  this->cubeTexture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
-  this->cubeTexture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
-  this->cubeTexture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
-  this->cubeTexture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
-  this->cubeTexture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
+  this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(top, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
+  this->cubeTexture[1] = (Texture*)ResourceManager::getInstance()->load(bottom, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
+  this->cubeTexture[2] = (Texture*)ResourceManager::getInstance()->load(left, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
+  this->cubeTexture[3] = (Texture*)ResourceManager::getInstance()->load(right, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
+  this->cubeTexture[4] = (Texture*)ResourceManager::getInstance()->load(front, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
+  this->cubeTexture[5] = (Texture*)ResourceManager::getInstance()->load(back, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
 }
 
 void SkyBox::enableCubeMap()
 {
-  glEnable(GL_TEXTURE_2D);
+  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
+  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
+  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
+
   glEnable(GL_TEXTURE_CUBE_MAP_EXT);
-  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
-  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
-  glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
+
   glEnable(GL_TEXTURE_GEN_S);
   glEnable(GL_TEXTURE_GEN_T);
@@ -194,5 +198,5 @@
 void SkyBox::disableCubeMap()
 {
-  glDisable(GL_TEXTURE_CUBE_MAP_EXT);
+  glDisable(GL_TEXTURE_CUBE_MAP);
   glDisable(GL_TEXTURE_2D);
   glDisable(GL_TEXTURE_GEN_S);
