Index: /experimental/distortionNG/extViewer.cpp
===================================================================
--- /experimental/distortionNG/extViewer.cpp	(revision 351)
+++ /experimental/distortionNG/extViewer.cpp	(revision 352)
@@ -32,5 +32,4 @@
 #include <osgUtil/SmoothingVisitor>
 
-#include "DistortionManipulator.h"
 
 extViewer::extViewer() : Viewer()
@@ -138,16 +137,14 @@
 
 
-void extViewer::setUpViewForManualDistortion(unsigned int screenNum, osg::Image* intensityMap, const osg::Matrixd& projectorMatrix)
+void extViewer::setUpViewForManualDistortion(osgViewer::DistortionSet* distSet, unsigned int screenNum, const osg::Matrixd& projectorMatrix)
 {
 	OSG_INFO<<"View::setUpViewForManualDistortion(sn="<<screenNum<<")"<<std::endl;
 
-	// Create DistortionSet
-	_distortionSet = new osgViewer::DistortionSet();
-	_distortionSet->setIntensityMap( intensityMap );
-	_distortionSet->setDistortionMeshRows( 20 );
-	_distortionSet->setDistortionMeshColumns( 20 );
-
-
-
+	if(distSet == NULL)
+	{
+        OSG_NOTICE<<"Error, no DistortionSet specified, cannot setup distortion."<<std::endl;
+        return;
+	}
+	_distortionSet = distSet;
 
     osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
@@ -238,5 +235,5 @@
         camera->attach(osg::Camera::COLOR_BUFFER, sceneTexture);
 
-        addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());
+        addSlave(camera.get(), _distortionSet->getProjectionOffset(), _distortionSet->getViewOffset() );
     }
 
@@ -276,24 +273,20 @@
         camera->setViewMatrix(osg::Matrix::identity());
 
+		osg::ref_ptr<osg::Group> root = new osg::Group;
+		root->addChild(geode);	// add mesh to root so camera renders mesh (and  thus render the scene)
+		camera->addChild(root);
+
 		// selector
-		geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
-		geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
-		osg::ref_ptr<distortionHandler> selectorHandler = new distortionHandler( camera, distortionMesh );
-		osg::ref_ptr<osg::Group> root = new osg::Group;
-		root->addChild(geode);
-		osg::Geode* selectorHighlighter = selectorHandler->createVertexHighlighter();
-		selectorHighlighter->setCullingActive(false);	// disable the culling for the selector, otherwise the selector is culled away on the edge.
-		root->addChild(selectorHighlighter);
-		addEventHandler( selectorHandler.get() );
-		camera->addChild(root);
-		// Avoid that the highlighter is culled away
-		osg::CullSettings::CullingMode mode = camera->getCullingMode();
-		camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
-
-		// Add the distortionHandler
-		osgViewer::DistortionManipulator* distManip = new osgViewer::DistortionManipulator();
-		distManip->setDistortionSet(_distortionSet);
-		addEventHandler(distManip);
-
+		//geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
+		//geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
+		//osg::ref_ptr<distortionHandler> selectorHandler = new distortionHandler( camera, distortionMesh );
+		//osg::Geode* selectorHighlighter = selectorHandler->createVertexHighlighter();
+		//selectorHighlighter->setCullingActive(false);	// disable the culling for the selector, otherwise the selector is culled away on the edge.
+		//root->addChild(selectorHighlighter);
+		//addEventHandler( selectorHandler.get() );// should be in main.cpp
+		
+		//// Avoid that the highlighter is culled away
+		//osg::CullSettings::CullingMode mode = camera->getCullingMode();
+		//camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
 
         camera->setName("Dist Cam");
Index: /experimental/distortionNG/extViewer.h
===================================================================
--- /experimental/distortionNG/extViewer.h	(revision 351)
+++ /experimental/distortionNG/extViewer.h	(revision 352)
@@ -37,5 +37,5 @@
 
 		/** Convenience method for projection on curved screens using a slave camera rendering scene and a second camera doing distortion correction to present on a nonplaner display.*/
-        void setUpViewForManualDistortion(unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
+        void setUpViewForManualDistortion(osgViewer::DistortionSet* distSet, unsigned int screenNum=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
 
 		void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, osg::StateSet* stateset, unsigned int screenNum=0);
Index: /experimental/distortionNG/main.cpp
===================================================================
--- /experimental/distortionNG/main.cpp	(revision 351)
+++ /experimental/distortionNG/main.cpp	(revision 352)
@@ -35,4 +35,7 @@
 #include <osgGA/AnimationPathManipulator>
 #include <osgGA/TerrainManipulator>
+
+#include "DistortionManipulator.h"
+
 int main(int argc, char** argv)
 {
@@ -48,7 +51,14 @@
 		return -1;
 	} 
-
-	viewer.setUpViewForManualDistortion(0, intMap);
-    
+	// Create DistortionSet
+	osg::ref_ptr<osgViewer::DistortionSet> _distortionSet = new osgViewer::DistortionSet();
+	_distortionSet->setIntensityMap( intMap );
+	_distortionSet->setDistortionMeshRows( 20 );
+	_distortionSet->setDistortionMeshColumns( 20 );
+	
+	viewer.setUpViewForManualDistortion(_distortionSet, 0);
+   
+	
+
 	// set up the camera manipulators.
     {
@@ -77,4 +87,8 @@
     }
 
+	// Add the distortion manipulator
+	osgViewer::DistortionManipulator* distManip = new osgViewer::DistortionManipulator();
+	distManip->setDistortionSet(_distortionSet);
+	viewer.addEventHandler(distManip);
 
     // add the state manipulator
