Index: osgVisual/src/distortion/visual_distortion.cpp
===================================================================
--- osgVisual/src/distortion/visual_distortion.cpp	(revision 148)
+++ osgVisual/src/distortion/visual_distortion.cpp	(revision 149)
@@ -45,29 +45,80 @@
 	xmlDoc* tmpDoc;
 	xmlNode* config = util::getModuleXMLConfig( configFileName, "distortion", tmpDoc );
+	
+	// extract configuration values
 	if(config)
 	{
-		xmlNode* a_node = config;
-		// Extract infos
-		std::string name = "";
-		bool enabled = false;
-
-		xmlAttr  *attr = a_node->properties;
-		while ( attr ) 
-		{ 
-			std::string attr_name=reinterpret_cast<const char*>(attr->name);
-			std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
-			if( attr_name == "name" )
-				name = reinterpret_cast<const char*>(attr->children->content);
-			if( attr_name == "enabled" && attr_value== "yes" )
-				enabled = true;
-			if( attr_name == "enabled" && attr_value== "no" )
-				enabled = false;
-
-			attr = attr->next; 
-		} 
-		OSG_ALWAYS << "Module '" << name << "' found. Enabled = " << enabled << std::endl;
-	}
-
-	// extract configuration values
+	
+		xmlNode* a_node = config->children;
+
+		for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next)
+		{
+			std::string node_name=reinterpret_cast<const char*>(cur_node->name);
+			OSG_ALWAYS << "----visual_distortion::processXMLConfiguration() - node type="<< cur_node->type <<", name=" << cur_node->name << std::endl;
+
+			// Check for distortion node
+			if(cur_node->type == XML_ELEMENT_NODE && node_name == "distortion")
+			{
+				xmlAttr  *attr = cur_node->properties;
+				while ( attr ) 
+				{ 
+					std::string attr_name=reinterpret_cast<const char*>(attr->name);
+					std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
+					if( attr_name == "channelname" )
+						channelname = attr_value;
+					if( attr_name == "renderimplemmentation" )
+					{
+						if(attr_value=="fbo")
+							renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
+						if(attr_value=="pbuffer")
+							renderImplementation = osg::Camera::PIXEL_BUFFER;
+						if(attr_value=="pbuffer-rtt")
+							renderImplementation = osg::Camera::PIXEL_BUFFER_RTT;
+						if(attr_value=="fb")
+							renderImplementation = osg::Camera::FRAME_BUFFER;
+						if(attr_value=="window")
+							renderImplementation = osg::Camera::SEPERATE_WINDOW;           
+					}
+					if( attr_name == "width" )
+					{
+						std::stringstream sstr(attr_value);
+						sstr >> tex_width;
+					}
+					if( attr_name == "height" )
+					{
+						std::stringstream sstr(attr_value);
+						sstr >> tex_height;
+					}
+					if( attr_name == "useshader" )
+						useShaderDistortion = (attr_value == "yes") ? true : false;
+					if( attr_name == "hdr" )
+						useHDR = (attr_value == "yes") ? true : false;
+					if( attr_name == "usetexturerectangle" )
+						useTextureRectangle = (attr_value == "yes") ? true : false;
+
+
+					attr = attr->next; 
+				}	// WHILE attrib END
+			}	// IF Node == distortion END
+
+			// Check for distortionmap node
+			if(cur_node->type == XML_ELEMENT_NODE && node_name == "distortionmap")
+			{
+
+			}
+
+			// Check for distortionmap node
+			if(cur_node->type == XML_ELEMENT_NODE && node_name == "blendmap")
+			{
+
+			}
+		}	// FOR all nodes END
+
+
+	}	// IF Config valid END
+	else
+		OSG_WARN << "ERROR: visual_distortion::processXMLConfiguration() - Invalid module configuration!" << std::endl;
+
+
 
 	// clean up
@@ -85,39 +136,7 @@
 	// Distortion files.
 	arguments.getApplicationUsage()->addCommandLineOption("-C <channelname>","Setup the channel name, this is the preset for blendmap, distortionmap and camera configuration file.");
-    arguments.getApplicationUsage()->addCommandLineOption("--distortionmap","Set a distortion map file name.");
+
+	arguments.getApplicationUsage()->addCommandLineOption("--distortionmap","Set a distortion map file name.");
     arguments.getApplicationUsage()->addCommandLineOption("--blendmap","Set a blend map file name.");
-
-	// Render implementation.
-	arguments.getApplicationUsage()->addCommandLineOption("--shaderDistortion","Use OpenGL shader for distortion and blending.");
-	arguments.getApplicationUsage()->addCommandLineOption("--fbo","Use Frame Buffer Object for render to texture, where supported.");
-    arguments.getApplicationUsage()->addCommandLineOption("--fb","Use FrameBuffer for render to texture.");
-    arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Use Pixel Buffer for render to texture, where supported.");
-    arguments.getApplicationUsage()->addCommandLineOption("--window","Use a seperate Window for render to texture.");
-
-	// Texture
-    arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture.");		// used for all render implementations
-    arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture.");	// used for all render implementations
-
-	// Texture Rectangle?
-    arguments.getApplicationUsage()->addCommandLineOption("--texture-rectangle","Use osg::TextureRectangle for doing the render to texure to.");
-
-	// HDR?
-    arguments.getApplicationUsage()->addCommandLineOption("--hdr","Render distortion as HDR.");
-
-	// Read out Distortion CMDLine arguments
-	//while (arguments.read("--width", tex_width)) {}
-    //while (arguments.read("--height", tex_height)) {}
-
-	//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; }
-	//while (arguments.read("--fb")) { renderImplementation = osg::Camera::FRAME_BUFFER; }
-	//while (arguments.read("--window")) { renderImplementation = osg::Camera::SEPERATE_WINDOW; }
-
-    //while (arguments.read("--texture-rectangle")) { useTextureRectangle = true; }
-
-    //while (arguments.read("--shaderDistortion")) { useShaderDistortion = true; }
-
-    //while (arguments.read("--hdr")) { useHDR = true; }
 
 	//while (arguments.read("--distortionmap", distortMapFileName)) { }
@@ -170,6 +189,6 @@
 	blendMapFileName = "..\\resources\\distortion\\blend_distDisabled.bmp";
 
-
-
+	// Process XML configuration
+	processXMLConfiguration();
 
 	// Process Commandline arguments:
