Index: /branches/water/src/lib/graphics/shader.h
===================================================================
--- /branches/water/src/lib/graphics/shader.h	(revision 7779)
+++ /branches/water/src/lib/graphics/shader.h	(revision 7780)
@@ -47,4 +47,7 @@
   inline static void restoreShader() { if (storedShader != NULL) storedShader->activateShader(); storedShader = NULL; };
 
+  GLhandleARB getProgram() { return this->shaderProgram; }
+  GLhandleARB getVertexS() { return this->vertexShader; }
+  GLhandleARB getFragmentS() { return this->fragmentShader; }
 
   void printError(GLhandleARB program);
Index: /branches/water/src/story_entities/game_world.cc
===================================================================
--- /branches/water/src/story_entities/game_world.cc	(revision 7779)
+++ /branches/water/src/story_entities/game_world.cc	(revision 7780)
@@ -476,4 +476,5 @@
     // clear buffer
   glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+  glLoadIdentity();
 
   const std::list<BaseObject*>* reflectedWaters;
Index: /branches/water/src/world_entities/environments/mapped_water.cc
===================================================================
--- /branches/water/src/world_entities/environments/mapped_water.cc	(revision 7779)
+++ /branches/water/src/world_entities/environments/mapped_water.cc	(revision 7780)
@@ -17,5 +17,6 @@
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
-#include "material.h"
+
+
 
 
@@ -32,14 +33,31 @@
     this->loadParams(root);
 
-
-    mat.setDiffuseMap(&this->texture, 0);
-    // Change the view port to be the size of the texture we will render to
-    // HACK
-    this->textureSize = 512;
+  //! HACK FIXME HACK FIXME HACK FIXME HACK FIXME
+  //! todo: rename texture to reflection texture
+  // set up refleciton texture
+  //mat.setDiffuseMap(&this->texture, 0);
+  mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0);
+  mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 1);
+  mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 2);
+  mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 3);
+  mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);
+  // load refraction texture
+  //mat.setDiffuseMap(&this->refractionTexture, 1);
+  // load normal map
+  //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
+  // load dudv map
+  //mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
+  // set up depth texture
+  //mat.setDiffuseMap(&this->depthTexture, 4);
+  
+  // set the size of the refraction and reflection textures
+  this->textureSize = 512;
+
+  shader = new Shader("/home/lieni/orxonox/data/trunk/shaders/water.vert", "/home/lieni/orxonox/data/trunk/shaders/mapped_water.frag");
 }
 
 MappedWater::~MappedWater()
 {
-
+  delete shader;
 }
 
@@ -55,10 +73,4 @@
 {
   glPushMatrix();
-
-  /*
-  glTranslatef (this->getAbsCoor ().x,
-                this->getAbsCoor ().y,
-                this->getAbsCoor ().z);
-  */
   glTranslatef(0,this->waterHeight,0);
 
@@ -78,20 +90,80 @@
 
   mat.select();
+  // Shader init
+  this->shader->activateShader();
+  GLint uniform;
+  
+  // Set the variable "reflection" to correspond to the first texture unit
+  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
+  //uniform = glGetUniformLocationARB(shader->getProgram(), "refraction");
+  //glUniform1iARB(uniform, 0);
+  // FIXME glUniform1iARB(uniform, 1);
+
+  // Set the variable "normalMap" to correspond to the third texture unit
+  //uniform = glGetUniformLocationARB(shader->getProgram(), "normalMap");
+  //glUniform1iARB(uniform, 2);
+
+  // Set the variable "dudvMap" to correspond to the fourth texture unit
+  uniform = glGetUniformLocationARB(shader->getProgram(), "dudvMap"); 
+  glUniform1iARB(uniform, 3);
+
+  // Set the variable "depthMap" to correspond to the fifth texture unit
+  //uniform = glGetUniformLocationARB(shader->getProgram(), "depthMap");
+  //glUniform1iARB(uniform, 4); 
+  // FIXME we dont have a depthMap yet :-(
+
+  // Give the variable "waterColor" a blue color
+  uniform = glGetUniformLocationARB(shader->getProgram(), "waterColor");
+  glUniform4fARB(uniform, 0.1f, 0.2f, 0.4f, 1.0f); 
+
+  // FIXME set camera and light information
+  Vector lightPos(100.0f, 150.0f, 100.0f);
+
+  // Store the camera position in a variable
+  //CVector3 vPosition = g_Camera.Position();
+  Vector vPosition(50.0f, 50.0f, 50.0f);
+
+  // Give the variable "lightPos" our hard coded light position
+  uniform = glGetUniformLocationARB(shader->getProgram(), "lightPos");
+  glUniform4fARB(uniform, lightPos.x, lightPos.y, lightPos.z, 1.0f); 
+
+  // Give the variable "cameraPos" our camera position
+  uniform = glGetUniformLocationARB(shader->getProgram(), "cameraPos");
+  glUniform4fARB(uniform, vPosition.x, vPosition.y, vPosition.z, 1.0f); 
 
   glBegin(GL_QUADS);
     glNormal3f(0,1,0);
-    glTexCoord2f(0,0);
-    //glMultiTexCoord2f(GL_TEXTURE1, 0,0);
+    glMultiTexCoord2f(GL_TEXTURE0, 0,0);
+    glMultiTexCoord2f(GL_TEXTURE1, 0,0);
+    glMultiTexCoord2f(GL_TEXTURE2, 0,0);
+    glMultiTexCoord2f(GL_TEXTURE3, 0,0);
+    glMultiTexCoord2f(GL_TEXTURE4, 0,0);
     glVertex3f(0,0,0);
-    glTexCoord2f(1,0);
-    //glMultiTexCoord2f(GL_TEXTURE1, 1,0);
+
+    glMultiTexCoord2f(GL_TEXTURE0, 1,0);
+    glMultiTexCoord2f(GL_TEXTURE1, 1,0);
+    glMultiTexCoord2f(GL_TEXTURE2, 1,0);
+    glMultiTexCoord2f(GL_TEXTURE3, 1,0);
+    glMultiTexCoord2f(GL_TEXTURE4, 1,0);
     glVertex3f(100,0,0);
-    glTexCoord2f(1,1);
-    //glMultiTexCoord2f(GL_TEXTURE1, 1,1);
+
+    glMultiTexCoord2f(GL_TEXTURE0, 1,1);
+    glMultiTexCoord2f(GL_TEXTURE1, 1,1);
+    glMultiTexCoord2f(GL_TEXTURE2, 1,1);
+    glMultiTexCoord2f(GL_TEXTURE3, 1,1);
+    glMultiTexCoord2f(GL_TEXTURE4, 1,1);
     glVertex3f(100,0,-100);
-    glTexCoord2f(0,1);
-    //glMultiTexCoord2f(GL_TEXTURE1, 0,1);
+
+    glMultiTexCoord2f(GL_TEXTURE0, 0,1);
+    glMultiTexCoord2f(GL_TEXTURE1, 0,1);
+    glMultiTexCoord2f(GL_TEXTURE2, 0,1);
+    glMultiTexCoord2f(GL_TEXTURE3, 0,1);
+    glMultiTexCoord2f(GL_TEXTURE4, 0,1);
     glVertex3f(0,0,-100);
   glEnd();
+  this->shader->deactivateShader();
 
   glPopMatrix();
@@ -165,9 +237,10 @@
 void MappedWater::deactivateReflection()
 {
-  //glBindTexture(GL_TEXTURE_2D, texture.getTexture());
+  //glBindTexture(GL_TEXTURE_2D, texture.getTexture()); is done by mat.select();
 
   //mat.setDiffuseMap(&texture, 0);
-  mat.select();
-  glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
+  
+  //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 7779)
+++ /branches/water/src/world_entities/environments/mapped_water.h	(revision 7780)
@@ -11,5 +11,5 @@
 #include "material.h"
 #include "texture.h"
-
+#include "shader.h"
 
 class MappedWater : public WorldEntity
@@ -39,4 +39,5 @@
     Texture         texture;
     int             textureSize;       //!< size of the texture
+    Shader*         shader;
 
 };
