Index: osgVisual/bin/osgVisualConfig.xml
===================================================================
--- osgVisual/bin/osgVisualConfig.xml	(revision 146)
+++ osgVisual/bin/osgVisualConfig.xml	(revision 147)
@@ -2,5 +2,18 @@
 <osgvisualconfiguration>
   <module name="distortion" enabled="yes">
-    <distortion channelname="center"></distortion>
+    <!-- XML configuration of the module "distortion"
+      channelname = name of he channel, used to load the distortion- and blendmaps
+      renderimplementation = technique to distort.
+      Available options: 
+          fbo : renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT
+          pbuffer : renderImplementation = osg::Camera::PIXEL_BUFFER
+          pbuffer-rtt :  renderImplementation = osg::Camera::PIXEL_BUFFER_RTT
+          fb : renderImplementation = osg::Camera::FRAME_BUFFER
+          window : renderImplementation = osg::Camera::SEPERATE_WINDOW
+    -->
+    <distortion channelname="center" renderimplemmentation="fbo" hdr="yes">
+      <!-- optional: <distortionmap filename="distmap.png"></distortionmap> -->
+      <!-- optional: <blendmap filename="blendmap.png"></blendmap> -->
+  </distortion>
   </module>
   <module name="sky_silverlining" enabled="yes"></module>
Index: osgVisual/resources/distortion/shader.frag
===================================================================
--- osgVisual/resources/distortion/shader.frag	(revision 147)
+++ osgVisual/resources/distortion/shader.frag	(revision 147)
@@ -0,0 +1,18 @@
+uniform sampler2D textureImage;
+uniform sampler2D textureDistort;
+uniform sampler2D textureBlend;
+
+void main()
+{
+    vec4 texCoord;
+    vec4 distortColor;
+    vec4 blendColor;
+
+    distortColor = texture2D(textureDistort, gl_TexCoord[0].st);
+    blendColor = texture2D(textureBlend, gl_TexCoord[0].st);
+
+    texCoord.s = (distortColor.b + mod(floor(distortColor.r * 255.5), 16.0)) / 16.0;
+    texCoord.t = 1.0 - (distortColor.g + floor(distortColor.r * 255.5 / 16.0)) / 16.0;
+
+    gl_FragColor = texture2D(textureImage, texCoord.st) * blendColor;
+}
Index: osgVisual/resources/distortion/shader.vert
===================================================================
--- osgVisual/resources/distortion/shader.vert	(revision 147)
+++ osgVisual/resources/distortion/shader.vert	(revision 147)
@@ -0,0 +1,5 @@
+void main()
+{
+	gl_Position = ftransform();
+	gl_TexCoord[0] = gl_MultiTexCoord0;
+}
Index: osgVisual/src/distortion/visual_distortion.cpp
===================================================================
--- osgVisual/src/distortion/visual_distortion.cpp	(revision 146)
+++ osgVisual/src/distortion/visual_distortion.cpp	(revision 147)
@@ -63,15 +63,9 @@
     arguments.getApplicationUsage()->addCommandLineOption("--hdr","Render distortion as HDR.");
 
-	arguments.getApplicationUsage()->addKeyboardMouseBinding("d", "Toggle Distortion.");
-
 	// Read out Distortion CMDLine arguments
-	tex_width = 2048;
-    tex_height = 2048;
-    while (arguments.read("--width", tex_width)) {}
+	while (arguments.read("--width", tex_width)) {}
     while (arguments.read("--height", tex_height)) {}
 
-	renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
-
-    while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; }
+	while (arguments.read("--fbo")) { renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT; }
     while (arguments.read("--pbuffer")) { renderImplementation = osg::Camera::PIXEL_BUFFER; }
     while (arguments.read("--pbuffer-rtt")) { renderImplementation = osg::Camera::PIXEL_BUFFER_RTT; }
@@ -79,14 +73,11 @@
     while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
 
-    useTextureRectangle = false;
     while (arguments.read("--texture-rectangle")) { useTextureRectangle = true; }
-	useShaderDistortion = false;
+
     while (arguments.read("--shaderDistortion")) { useShaderDistortion = true; }
-    useHDR = false; 
+
     while (arguments.read("--hdr")) { useHDR = true; }
 
-	distortMapFileName = "..\\resources\\distortion\\distort_distDisabled.bmp";
-    while (arguments.read("--distortionmap", distortMapFileName)) { }
-	blendMapFileName = "..\\resources\\distortion\\blend_distDisabled.bmp";
+	while (arguments.read("--distortionmap", distortMapFileName)) { }
     while (arguments.read("--blendmap", blendMapFileName)) { }
 
@@ -127,4 +118,17 @@
 	OSG_NOTIFY (osg::ALWAYS ) << "visual_distortion initialize..." << std::endl;
 
+	// Initialize variables:
+	tex_width = 2048;
+    tex_height = 2048;
+	renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
+	useTextureRectangle = false;
+	useShaderDistortion = false;
+	useHDR = false; 
+	distortMapFileName = "..\\resources\\distortion\\distort_distDisabled.bmp";
+	blendMapFileName = "..\\resources\\distortion\\blend_distDisabled.bmp";
+
+
+
+
 	// Process Commandline arguments:
 	processCommandlineparameters();
@@ -134,4 +138,5 @@
 
 	// add the keyboard handler for toggle distortion
+	arguments.getApplicationUsage()->addKeyboardMouseBinding("d", "Toggle Distortion.");
 	kBEventHandler = new ToggleDistortionKBEventHandler( this );
 	viewer->addEventHandler( kBEventHandler );
@@ -379,6 +384,6 @@
             osg::Shader* distortFragObj = new osg::Shader( osg::Shader::FRAGMENT );
 
-            if (loadShaderSource( distortVertObj, "shader.vert" ) &&
-                loadShaderSource( distortFragObj, "shader.frag" ) &&
+            if (loadShaderSource( distortVertObj, "../resources/distortion/shader.vert" ) &&
+                loadShaderSource( distortFragObj, "../resources/distortion/shader.frag" ) &&
                 distortMapTexture)
             {
