Index: branches/water/src/world_entities/environments/mapped_water.cc
===================================================================
--- branches/water/src/world_entities/environments/mapped_water.cc	(revision 7982)
+++ branches/water/src/world_entities/environments/mapped_water.cc	(revision 7983)
@@ -43,7 +43,7 @@
   mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
   // load dudv map
-  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
+   mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
   // set up depth texture
-  mat.setDiffuseMap("pictures/sky-replace.jpg", 4);
+//  mat.setDiffuseMap("pictures/sky-replace.jpg", 4);
 
   // set the size of the refraction and reflection textures
@@ -58,6 +58,6 @@
   unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels];
   memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
-  unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
-  memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
+//  unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
+//  memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
   // Register the texture with OpenGL and bind it to the texture ID
   mat.select();
@@ -70,6 +70,6 @@
 
   //the same for the refraction
-  glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
-  glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
+//  glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
+//  glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
 
   // Set the texture quality
@@ -81,5 +81,5 @@
   // Since we stored the texture space with OpenGL, we can delete the image data
   delete [] pTextureReflection;
-  delete [] pTextureRefraction;
+//  delete [] pTextureRefraction;
 
 
@@ -91,4 +91,24 @@
   this->kNormalMapScale = 0.25f;
   this->g_WaterFlow = 0.0015f;
+
+  /// Initialization of the shaders
+  this->shader->activateShader();
+  // Set the variable "reflection" to correspond to the first texture unit
+  Shader::Uniform(shader, "reflection").set(0);
+
+  // Set the variable "refraction" to correspond to the second texture unit
+  //this->uni = new Shader::Uniform (shader, "refraction");
+  //this->uni->set(1);
+
+  // Set the variable "normalMap" to correspond to the third texture unit
+  Shader::Uniform(shader, "normalMap").set(2);
+
+  // Set the variable "dudvMap" to correspond to the fourth texture unit
+  Shader::Uniform(shader, "dudvMap").set(3);
+
+  // Set the variable "depthMap" to correspond to the fifth texture unit
+  //this->uni = new Shader::Uniform (shader, "depthMap");
+  //this->uni->set(4);
+  this->shader->activateShader();
 }
 
@@ -111,21 +131,7 @@
   glTranslatef(0,this->waterHeight,0);
 
-  //HACK
-  
-  //glEnable(GL_LIGHTING);
-
-
-  //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 1);
-  //mat.setTransparency(1.0);
-  //mat.setDiffuse(1.0, 0, .1);
-
-
-  // HACK
-
-  //glActiveTexture(GL_TEXTURE0);
-  //glBindTexture(GL_TEXTURE_2D, this->texture);
   mat.unselect();
   mat.select();
-  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
+
 
 
@@ -133,36 +139,8 @@
   this->shader->activateShader();
   GLint uniform;
-  Shader::Uniform* uni;
-
-  // Set the variable "reflection" to correspond to the first texture unit
-  uni = new Shader::Uniform (shader, "reflection");
-  uni->set(0);
-  //uniform = glGetUniformLocationARB(shader->getProgram(), "reflection");
-  //glUniform1iARB(uniform, 0); //second paramter is the texture unit
-
-  // Set the variable "refraction" to correspond to the second texture unit
- // uni = new Shader::Uniform (shader, "refraction");
- // uni->set(1);
-  //uniform = glGetUniformLocationARB(shader->getProgram(), "refraction");
-  //glUniform1iARB(uniform, 1);
-
-  // Set the variable "normalMap" to correspond to the third texture unit
-  uni = new Shader::Uniform (shader, "normalMap");
-  uni->set(2);
-  //uniform = glGetUniformLocationARB(shader->getProgram(), "normalMap");
-  //glUniform1iARB(uniform, 2);
-
-  // Set the variable "dudvMap" to correspond to the fourth texture unit
-  uni = new Shader::Uniform (shader, "dudvMap");
-  uni->set(3);
-  //uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap");
-  //glUniform1iARB(uniform, 3);
-
-  // Set the variable "depthMap" to correspond to the fifth texture unit
- // uni = new Shader::Uniform (shader, "depthMap");
- // uni->set(4);
-  //uniform = glGetUniformLocationARB(shader->getProgram(), "depthMap");
-  //glUniform1iARB(uniform, 4);
-  // FIXME we dont have a depthMap yet :-(
+
+
+
+
 
   // Give the variable "waterColor" a blue color
@@ -192,33 +170,33 @@
   glBegin(GL_QUADS);
   // The back left vertice for the water
-  glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, g_WaterUV);            // Reflection texture
-  glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, refrUV - move);        // Refraction texture
-  glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, normalUV + move2);     // Normal map texture
-  glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                       // DUDV map texture
-  glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                       // Depth texture
+  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, g_WaterUV);            // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move);        // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
+  glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                       // Depth texture
   glVertex3f(0.0f, waterHeight, 0.0f);
 
   // The front left vertice for the water
-  glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);                  // Reflection texture
-  glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f - move);           // Refraction texture
-  glMultiTexCoord2fARB(GL_TEXTURE2_ARB, 0.0f, 0.0f + move2);          // Normal map texture
-  glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                        // DUDV map texture
-  glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                        // Depth texture
+  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);                  // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move);           // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
+  glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
   glVertex3f(0.0f, waterHeight, 1000.0f);
 
   // The front right vertice for the water
-  glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, 0.0f);             // Reflection texture
-  glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, 0.0f - move);         // Refraction texture
-  glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, 0.0f + move2);      // Normal map texture
-  glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                        // DUDV map texture
-  glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                        // Depth texture
+  glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, 0.0f);             // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move);         // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
+  glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
   glVertex3f(1000.0f, waterHeight, 1000.0f);
 
   // The back right vertice for the water
-  glMultiTexCoord2fARB(GL_TEXTURE0_ARB, g_WaterUV, g_WaterUV);        // Reflection texture
-  glMultiTexCoord2fARB(GL_TEXTURE1_ARB, refrUV, refrUV - move);       // Refraction texture
-  glMultiTexCoord2fARB(GL_TEXTURE2_ARB, normalUV, normalUV + move2);  // Normal map texture
-  glMultiTexCoord2fARB(GL_TEXTURE3_ARB, 0, 0);                        // DUDV map texture
-  glMultiTexCoord2fARB(GL_TEXTURE4_ARB, 0, 0);                        // Depth texture
+  glMultiTexCoord2f(GL_TEXTURE0, g_WaterUV, g_WaterUV);        // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move);       // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
+  glMultiTexCoord2f(GL_TEXTURE4, 0, 0);                        // Depth texture
   glVertex3f(1000.0f, waterHeight, 0.0f);
   glEnd();
@@ -226,6 +204,5 @@
   this->shader->deactivateShader();
 
-
-  Material::unselect();
+  mat.unselect();
 
   glPopMatrix();
@@ -234,5 +211,6 @@
 void MappedWater::tick(float dt)
 {
-  this->move += this->g_WaterFlow = 0.004;
+  // makes the water flow
+  this->move += this->g_WaterFlow;
   this->move2 = this->move * this->kNormalMapScale;
   this->refrUV = this->g_WaterUV;
@@ -248,5 +226,5 @@
 {
   glPushAttrib(GL_VIEWPORT_BIT);
-  
+
 
   //glLoadIdentity();
@@ -269,8 +247,8 @@
 
   // Since the world is updside down we need to change the culling to FRONT
-  glCullFace(GL_FRONT);
+  //glCullFace(GL_FRONT);
 
   // Set our plane equation and turn clipping on
-  double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
+  //double plane[4] = {0.0, 1.0, 0.0, -waterHeight};
   //glEnable(GL_CLIP_PLANE0);
   //glClipPlane(GL_CLIP_PLANE0, plane);
@@ -306,4 +284,5 @@
 
   //mat.setDiffuseMap(&texture, 0);
+
   mat.select();
   glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
Index: branches/water/src/world_entities/environments/mapped_water.h
===================================================================
--- branches/water/src/world_entities/environments/mapped_water.h	(revision 7982)
+++ branches/water/src/world_entities/environments/mapped_water.h	(revision 7983)
@@ -10,5 +10,4 @@
 #include "world_entity.h"
 #include "material.h"
-#include "texture.h"
 #include "shader.h"
 
@@ -34,16 +33,18 @@
 
   private:
-    float           waterHeight;                //!< y-coord of the Water
-    Material        mat;
-    float           move;
-    float           g_WaterUV;          //!< The scale for the water textures
-    float           kNormalMapScale;
-    float           g_WaterFlow;
-    float           move2;
-    float           refrUV;
-    float           normalUV;
+    float               waterHeight;                //!< y-coord of the Water
 
-    int             textureSize;                //!< size of the texture
-    Shader*         shader;
+    float               move;                       //!< textures coords, speeds, positions for the shaded textures....
+    float               move2;                      //!<
+    float               g_WaterUV;                  //!<
+    float               g_WaterFlow;                //!<
+    float               refrUV;                     //!<
+    float               normalUV;                   //!<
+    float               kNormalMapScale;            //!<
+
+    int                 textureSize;                //!< size of the texture
+    Material            mat;
+    Shader*             shader;
+    Shader::Uniform*    uni;
 
 };
