Index: /experimental/distortionNG/DistortionManipulator.cpp
===================================================================
--- /experimental/distortionNG/DistortionManipulator.cpp	(revision 349)
+++ /experimental/distortionNG/DistortionManipulator.cpp	(revision 350)
@@ -141,5 +141,5 @@
 
 
-				OSG_ALWAYS<<"KEY_KP_7 : activeVisualizationMode is now "<<activeVisualizationMode<<std::endl;
+				OSG_ALWAYS<<"KEY_KP_7 : activeVisualizationMode is now "<<activeVisualizationMode<<std::endl<<std::endl;
 				return(true);
 			}
@@ -225,3 +225,6 @@
 {
 		OSG_ALWAYS<<"ToDo: showIntensityMap(bool) is now "<<show<<std::endl;
-}
+
+		if(_distortionSet.valid())
+			_distortionSet->setShowIntensityMapOnly(show);
+}
Index: /experimental/distortionNG/DistortionSet.cpp
===================================================================
--- /experimental/distortionNG/DistortionSet.cpp	(revision 349)
+++ /experimental/distortionNG/DistortionSet.cpp	(revision 350)
@@ -24,4 +24,16 @@
 DistortionSet::DistortionSet()
 {
+	_distortionMeshRows = 1;
+	_distortionMeshColumns = 1;
+	//GLenum _meshType;
+	
+	_intensityMap = NULL;
+	_texUnitScene = 0;
+	_texUnitIntensityMap = 1;
+
+	_viewOffset = osg::Matrixd::identity();
+	_projectionOffset = osg::Matrixd::identity();
+
+	_showIntesityMapMapOnly = false;
 }
 
@@ -49,3 +61,5 @@
 	ADD_MATRIX_SERIALIZER( ViewOffset, osg::Matrix() );	//osg::Matrix _viewOffset;
 	ADD_MATRIX_SERIALIZER( ProjectionOffset, osg::Matrix() );	//osg::Matrix _projectionOffset;
+
+	ADD_BOOL_SERIALIZER( ShowIntensityMapOnly, false );	//bool _showIntesityMapMapOnly
 }
Index: /experimental/distortionNG/DistortionSet.h
===================================================================
--- /experimental/distortionNG/DistortionSet.h	(revision 349)
+++ /experimental/distortionNG/DistortionSet.h	(revision 350)
@@ -37,9 +37,17 @@
 		_texUnitIntensityMap(ds._texUnitIntensityMap),
 		_viewOffset(ds._viewOffset),
-		_projectionOffset(ds._projectionOffset){}
+		_projectionOffset(ds._projectionOffset),
+		_showIntesityMapMapOnly(ds._showIntesityMapMapOnly){}
 
 	DistortionSet();
 	virtual ~DistortionSet();
 
+	// Working access
+	osg::Image* getIntensityMap()  { return _intensityMap; }	// Also for manipulating the intensity map
+	bool& getShowIntensityMapOnlyAsRef()	{ return _showIntesityMapMapOnly;}
+
+
+
+	// Serializer Access
 	void setDistortionMeshRows(int distortionMeshRows)		{ _distortionMeshRows = distortionMeshRows; }
 	int getDistortionMeshRows() const	{ return _distortionMeshRows; }
@@ -52,6 +60,6 @@
 
 	void setIntensityMap(osg::Image* intensityMap)		{ _intensityMap = intensityMap; }
-	const osg::Image* getIntensityMap() const	{ return _intensityMap; }	// for serializers
-	osg::Image* getIntensityMap()  { return _intensityMap; }	// for manipulating the intensity map
+	const osg::Image* getIntensityMap() const	{ return _intensityMap; }
+
 
 	void setTexUnitScene(unsigned int texUnitScene)		{ _texUnitScene = texUnitScene; }
@@ -67,4 +75,8 @@
 	const osg::Matrixd& getProjectionOffset() const { return _projectionOffset; }
 
+	void setShowIntensityMapOnly(bool show)	{_showIntesityMapMapOnly = show;}
+	bool getShowIntensityMapOnly() const	{ return _showIntesityMapMapOnly;}
+
+
 private:
 	int _distortionMeshRows;
@@ -79,5 +91,5 @@
 	osg::Matrixd _projectionOffset;
 
-
+	bool _showIntesityMapMapOnly;	// Intensity Blending is done by a frag shader. To control it on runtime, the uniform must be bound to a central variable.
 };
 
Index: /experimental/distortionNG/extViewer.cpp
===================================================================
--- /experimental/distortionNG/extViewer.cpp	(revision 349)
+++ /experimental/distortionNG/extViewer.cpp	(revision 350)
@@ -57,52 +57,4 @@
 }
 
-//static osg::Texture2D* loadTexture( const std::string& fileName )
-//{
-//    std::string foundFileName = osgDB::findDataFile(fileName);
-//    if (foundFileName.length() != 0 )
-//    {
-//        // load distortion map texture file
-//        osg::Image* image = osgDB::readImageFile(foundFileName);
-//        if (image)
-//        {
-//			osg::Texture2D* texture = new osg::Texture2D;
-//            texture->setImage(image);
-//			texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
-//			texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
-//			texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
-//			texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
-//            return texture;
-//        }
-//    }
-//
-//    OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
-//
-//    return NULL;
-//}
-
-//static osg::TextureRectangle* loadTextureRect( const std::string& fileName )
-//{
-//    std::string foundFileName = osgDB::findDataFile(fileName);
-//    if (foundFileName.length() != 0 )
-//    {
-//        // load distortion map texture file
-//        osg::Image* image = osgDB::readImageFile(foundFileName);
-//        if (image)
-//        {
-//			osg::TextureRectangle* texture = new osg::TextureRectangle;
-//            texture->setImage(image);
-//            texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
-//            texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
-//            texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
-//            texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
-//            return texture;
-//        }
-//    }
-//
-//    OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
-//
-//    return NULL;
-//}
-
 static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, osg::Image* intensityMap, bool applyIntensityMapAsColours, const osg::Matrix& projectorMatrix)
 {
@@ -199,7 +151,17 @@
 }
 
+
 void extViewer::setUpViewForManualDistortion(unsigned int screenNum, osg::Image* intensityMap, const osg::Matrixd& projectorMatrix)
 {
-	OSG_INFO<<"View::setUpViewForManualDistortion(sn="<<screenNum<<", im="<<intensityMap<<")"<<std::endl;
+	OSG_INFO<<"View::setUpViewForManualDistortion(sn="<<screenNum<<")"<<std::endl;
+
+	// Create DistortionSet
+	_distortionSet = new osgViewer::DistortionSet();
+	_distortionSet->setIntensityMap( intensityMap );
+	_distortionSet->setDistortionMeshRows( 20 );
+	_distortionSet->setDistortionMeshColumns( 20 );
+
+
+
 
     osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
@@ -233,6 +195,4 @@
     traits->sharedContext = 0;
 
-	bool applyIntensityMapAsColours = false;
-
 	osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
     if (!gc)
@@ -302,5 +262,5 @@
         // StateSet to contain the Texture StateAttribute.
 	    osg::StateSet* stateset = geode->getOrCreateStateSet();
-        stateset->setTextureAttributeAndModes(0, sceneTexture,osg::StateAttribute::ON);
+        stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), sceneTexture,osg::StateAttribute::ON);
         stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
 
@@ -309,9 +269,7 @@
         stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
 
-		// If the intensityMap is used but not applyIntensityMapAsColours: Apply intensityMap as intensityMapTexture on unit 1
-		if (!applyIntensityMapAsColours && intensityMap)
-			setUpIntensityMapBlending(stateset, intensityMap, screenNum, 0, 1);	
-
-		osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, intensityMap, applyIntensityMapAsColours, projectorMatrix);
+		setUpIntensityMapBlending(_distortionSet, stateset, screenNum);
+
+		osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, _distortionSet->getIntensityMap(), false, projectorMatrix);
 		geode->addDrawable(distortionMesh);
 
@@ -347,9 +305,4 @@
 		camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
 
-		// Create DistortionSet
-		_distortionSet = new osgViewer::DistortionSet();
-		_distortionSet->setIntensityMap( intensityMap );
-
-
 		// Add the distortionHandler
 		osgViewer::DistortionManipulator* distManip = new osgViewer::DistortionManipulator();
@@ -364,7 +317,10 @@
 }
 
-void extViewer::setUpIntensityMapBlending(osg::StateSet* stateset, osg::Image* intensityMap, unsigned int screenNum, int rttSceneTextureUnit, int intensityMapTextureUnit)
-{
-	if(stateset == NULL || intensityMap == NULL)
+void extViewer::setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, osg::StateSet* stateset, unsigned int screenNum)
+{
+	osg::Image* intensityMap = _distortionSet->getIntensityMap();
+	if(intensityMap == NULL)	return;
+
+	if(stateset == NULL)
 	{
 		OSG_NOTICE<<"Error, no intensityMap or stateset for intensityMapBlending specified."<<std::endl;
@@ -400,5 +356,5 @@
 	intensityMapTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
 
-    stateset->setTextureAttributeAndModes(intensityMapTextureUnit, intensityMapTexture, osg::StateAttribute::ON);
+    stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitIntensityMap(), intensityMapTexture, osg::StateAttribute::ON);
 
 	// create shaders for blending
@@ -411,7 +367,30 @@
 	{
 		distortProgram->addShader( fShader );
-		stateset->addUniform( new osg::Uniform("sceneTexture", rttSceneTextureUnit) );
-		stateset->addUniform( new osg::Uniform("intensityMapTexture", intensityMapTextureUnit) );
+		//stateset->addUniform( new osg::Uniform("sceneTexture", _distortionSet->getTexUnitScene()) );
+		//stateset->addUniform( new osg::Uniform("intensityMapTexture", _distortionSet->getTexUnitIntensityMap()) );
+		stateset->addUniform( new osg::Uniform("sceneTexture", 0 ) );
+		stateset->addUniform( new osg::Uniform("intensityMapTexture", 1 ) );
 		stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
 	}
 }
+
+void extViewer::setUpIntensityMapBlending(std::string intensityMap)
+{
+	// Try to load intensityMap
+	osg::Image* intMap = osgDB::readImageFile(intensityMap);
+	if (!intMap)
+	{
+		osg::notify(osg::WARN) << "Quitting, couldn't find intensity map: " << intensityMap << std::endl;
+		return;
+	} 
+
+	// Create DistortionSet
+	_distortionSet = new osgViewer::DistortionSet();
+	_distortionSet->setIntensityMap( intMap );
+	_distortionSet->setDistortionMeshRows( 1 );
+	_distortionSet->setDistortionMeshColumns( 1 );
+	_distortionSet->setTexUnitScene( 0 );
+	_distortionSet->setTexUnitIntensityMap( 1 );
+
+	// Todo: call setupDistortion/Blendung to perform the blending
+}
Index: /experimental/distortionNG/extViewer.h
===================================================================
--- /experimental/distortionNG/extViewer.h	(revision 349)
+++ /experimental/distortionNG/extViewer.h	(revision 350)
@@ -23,4 +23,5 @@
 #include "DistortionSet.h"
 
+#include <string>
 
 class extViewer : public osgViewer::Viewer
@@ -38,5 +39,6 @@
         void setUpViewForManualDistortion(unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
 
-		void setUpIntensityMapBlending(osg::StateSet* stateset, osg::Image* intensityMap, unsigned int screenNum=0, int rttSceneTextureUnit=0, int intensityMapTextureUnit=1);
+		void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, osg::StateSet* stateset, unsigned int screenNum=0);
+		void setUpIntensityMapBlending(std::string intensityMap);
 
 		osgViewer::DistortionSet* getDistortionSet()	{return _distortionSet;}
Index: /experimental/distortionNG/main.cpp
===================================================================
--- /experimental/distortionNG/main.cpp	(revision 349)
+++ /experimental/distortionNG/main.cpp	(revision 350)
@@ -136,6 +136,6 @@
  * Layout vom Distortion System
  * 
- * Das distortion systme unterstüzt verzerrungen ,die pro kanal auhc nur eine camera verwenden.
- * Verzerrungen, die das Bild je Kanal aus mehreren Cams zusammensetzen um Views>=180° zu erreichen werden nicht unterstützt da hierfür das Camera Setup nötig wäre, welches nicht im distortion-Container gespeichert wird (Sonderfall, zu speziell für das Dist-Framework)
+ * Das distortion System unterstützt Verzerrungen, die pro Kanal jeweils nur eine camera verwenden.
+ * Verzerrungen, die das Bild je Kanal aus mehreren Cams zusammensetzen um Views>=180° zu erreichen werden nicht unterstützt da hierfür ein Camera Setup nötig wäre, welches nicht im distortion-Container gespeichert wird (Sonderfall, zu speziell für das Dist-Framework)
  * 
  * 
@@ -156,5 +156,6 @@
  * 										
  *										need to add setter/getter as well as the serializer macros.
- * 
+ *										
+ *										Besitz: Da osgViewer distSets ohne Manipulationsmöglichkeit konsumieren können soll, muss der COntainer vom Vierwer verwaltet werden.
  * 
  * osgViewer							load and apply distortion (apply via setupDistortion(...)
