Index: branches/water/src/lib/graphics/importer/material.cc
===================================================================
--- branches/water/src/lib/graphics/importer/material.cc	(revision 8031)
+++ branches/water/src/lib/graphics/importer/material.cc	(revision 8034)
@@ -390,10 +390,10 @@
  * @param textureNumber select the texture unit that will be overwritten
 */
-void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
+void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
 {
   glActiveTexture(Material::glTextureArbs[textureNumber]);
   glEnable(GL_TEXTURE_2D);
   glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
-  glCopyTexSubImage2D(target, 0, xoffset, yoffset, 0, 0, width, height);
+  glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
 }
 
Index: branches/water/src/lib/graphics/importer/material.h
===================================================================
--- branches/water/src/lib/graphics/importer/material.h	(revision 8031)
+++ branches/water/src/lib/graphics/importer/material.h	(revision 8034)
@@ -58,5 +58,5 @@
     void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
-    void renderToTexture(unsigned int textureNumber, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
+    void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
 
     void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
Index: branches/water/src/world_entities/environments/mapped_water.cc
===================================================================
--- branches/water/src/world_entities/environments/mapped_water.cc	(revision 8031)
+++ branches/water/src/world_entities/environments/mapped_water.cc	(revision 8034)
@@ -39,8 +39,8 @@
   /// loads the textures
   // set up refleciton texture
-  // FIXME mat.setDiffuseMap(this->texture, 0); doesnt work,
+  //mat.setDiffuseMap(this->texture, 0);
   mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 0);
   // load refraction texture
-  //mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);
+  mat.setDiffuseMap("pictures/error_texture.png", GL_TEXTURE_2D, 1);
   // load normal map
   //mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
@@ -60,6 +60,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();
@@ -72,6 +72,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
@@ -83,5 +83,5 @@
   // Since we stored the texture space with OpenGL, we can delete the image data
   delete [] pTextureReflection;
-  //delete [] pTextureRefraction;
+  delete [] pTextureRefraction;
 
 
@@ -149,5 +149,5 @@
   // The back left vertice for the water
   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0);//g_WaterUV);            // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, refrUV - move);        // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0);//refrUV - move);        // Refraction texture
   glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
@@ -157,5 +157,5 @@
   // The front left vertice for the water
   glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 1);//0.0f);                  // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move);           // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 1);//0.0f - move);           // Refraction texture
   glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
@@ -165,5 +165,5 @@
   // The front right vertice for the water
   glMultiTexCoord2f(GL_TEXTURE0, 1,1); //g_WaterUV, 0.0f);             // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, refrUV, 0.0f - move);         // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE1, 1,1);//refrUV, 0.0f - move);         // Refraction texture
   glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
@@ -173,5 +173,5 @@
   // The back right vertice for the water
   glMultiTexCoord2f(GL_TEXTURE0, 1,0);//g_WaterUV, g_WaterUV);        // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, refrUV, refrUV - move);       // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE1, 1,0);//refrUV, refrUV - move);       // Refraction texture
   glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
@@ -244,5 +244,5 @@
   mat.select();
   //glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
-  //mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize);
+  mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
 
   glPopMatrix();
@@ -291,5 +291,7 @@
 
   mat.select();
-  mat.renderToTexture(0, GL_TEXTURE_2D, 0, 0, textureSize, textureSize);
+  mat.renderToTexture(1, GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureSize, textureSize);
+  //glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, textureSize, textureSize, 0);
+  //mat.renderToTexture(0, GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, textureSize, textureSize, 0);
 
   // Bind the current scene to our refraction texture
