Index: osgVisual/bin/visual_master.bat
===================================================================
--- osgVisual/bin/visual_master.bat	(revision 69)
+++ osgVisual/bin/visual_master.bat	(revision 70)
@@ -1,1 +1,1 @@
-osgVisual.exe -C center -m --window 950 50 600 350 D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path
+osgVisual.exe --SingleThreaded -C center -m --window 950 50 600 350 D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path
Index: osgVisual/bin/visual_slave.bat
===================================================================
--- osgVisual/bin/visual_slave.bat	(revision 69)
+++ osgVisual/bin/visual_slave.bat	(revision 70)
@@ -1,1 +1,1 @@
-osgVisual.exe -C center -s --server localhost 12345 --window 950 450 600 350 D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path
+osgVisual.exe --SingleThreaded -C center -s --server localhost 12345 --window 950 450 600 350 D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive -p salzburg.path
Index: osgVisual/include/dataIO/dataIO_transportContainer.h
===================================================================
--- osgVisual/include/dataIO/dataIO_transportContainer.h	(revision 69)
+++ osgVisual/include/dataIO/dataIO_transportContainer.h	(revision 70)
@@ -34,4 +34,5 @@
 			frameID(tC_.frameID),
 			viewMatrix(tC_.viewMatrix),
+			projectionMatrix(tC_.projectionMatrix),
 			executer(tC_.executer),
 			ioSlots(tC_.ioSlots){}
@@ -48,4 +49,5 @@
 	int frameID;
 	osg::Matrixd viewMatrix;
+	osg::Matrixd projectionMatrix;
 	executerList executer;
 	slotList ioSlots;
@@ -58,4 +60,7 @@
 	void setViewMatrix(const osg::Matrixd& viewMatrix_){viewMatrix=viewMatrix_;}
 	const osg::Matrixd& getViewMatrix() const {return viewMatrix;}
+
+	void setProjectionMatrix(const osg::Matrixd& projectionMatrix_){projectionMatrix=projectionMatrix_;}
+	const osg::Matrixd& getProjectionMatrix() const {return projectionMatrix;}
 
 	void setExecuter(const executerList& executer_) {executer=executer_;}
Index: osgVisual/include/dataIO/visual_dataIO.h
===================================================================
--- osgVisual/include/dataIO/visual_dataIO.h	(revision 69)
+++ osgVisual/include/dataIO/visual_dataIO.h	(revision 70)
@@ -90,5 +90,4 @@
 	osg::ref_ptr<dataIO_eventCallback> eventCallback;
 
-
 	class dataIO_finalDrawCallback : public osg::Camera::DrawCallback
 	{
Index: osgVisual/include/sky_Silverlining/visual_skySilverLining.h
===================================================================
--- osgVisual/include/sky_Silverlining/visual_skySilverLining.h	(revision 69)
+++ osgVisual/include/sky_Silverlining/visual_skySilverLining.h	(revision 70)
@@ -97,11 +97,4 @@
 
 	/**
-	 * \brief This function initializes the sky framework if it's used with the main camera (without any PRE_RENDER camera like the distortion module).
-	 * 
-	 * @param sceneGraphRoot : osg::Group* which is the rootNode and coordinateSystemNode of the scene.
-	 */ 
-	void init(osg::CoordinateSystemNode *sceneGraphRoot);
-
-	/**
 	 * \brief This function can be called by the updateCallback. If the postInitialization for adding clouds etc. has be called already, this function will skip.
 	 * 
Index: osgVisual/src/cluster/dataIO_clusterENet.cpp
===================================================================
--- osgVisual/src/cluster/dataIO_clusterENet.cpp	(revision 69)
+++ osgVisual/src/cluster/dataIO_clusterENet.cpp	(revision 70)
@@ -125,4 +125,5 @@
 		sendContainer->setFrameID(viewer->getFrameStamp()->getFrameNumber());
 		sendContainer->setViewMatrix(viewer->getCamera()->getViewMatrix());
+		sendContainer->setProjectionMatrix(viewer->getCamera()->getProjectionMatrix());
 
 		// Writing node to stream
@@ -134,6 +135,6 @@
 			{
 				// Send Data via ENet:
-				OSG_NOTIFY( osg::ALWAYS ) << "dataIO_clusterUDP::sendTO_OBJvaluesToSlaves() - Bytes to send: " << myOstream.str().length() << std::endl;
-				//sOSG_NOTIFY( osg::ALWAYS ) << "Send: " << myOstream.str() << std::endl;
+				//OSG_NOTIFY( osg::ALWAYS ) << "dataIO_clusterUDP::sendTO_OBJvaluesToSlaves() - Bytes to send: " << myOstream.str().length() << std::endl;
+				//OSG_NOTIFY( osg::ALWAYS ) << "Send: " << myOstream.str() << std::endl;
 				ENetPacket * packet = enet_packet_create (myOstream.str().c_str(), 
 												  myOstream.str().size(), 
@@ -163,5 +164,5 @@
 	if (bytes_received > 0 )
 	{
-		OSG_NOTIFY( osg::ALWAYS ) << "dataIO_clusterENet::readTO_OBJvaluesFromMaster() - Bytes received: " << bytes_received << std::endl;
+		//OSG_NOTIFY( osg::ALWAYS ) << "dataIO_clusterENet::readTO_OBJvaluesFromMaster() - Bytes received: " << bytes_received << std::endl;
 		//OSG_NOTIFY( osg::ALWAYS ) << "Received: " << std::endl << receivedTransportContainer << std::endl;
 
@@ -177,7 +178,8 @@
 				if (sendContainer)
 				{
-					OSG_NOTIFY( osg::ALWAYS ) << "Received::FrameID is: " << sendContainer->getFrameID() << std::endl;
-					// Restore Viewmatrix
+					OSG_NOTIFY( osg::ALWAYS ) << "Received:: Settings Viewmatrix...FrameID is: " << sendContainer->getFrameID() << std::endl;
+					// Restore Viewmatrix / Projectionmatrix  
 					viewer->getCamera()->setViewMatrix(sendContainer->getViewMatrix());
+					//viewer->getCamera()->setProjectionMatrix(sendContainer->getProjectionMatrix());
 				}
 				else
Index: osgVisual/src/core/visual_core.cpp
===================================================================
--- osgVisual/src/core/visual_core.cpp	(revision 69)
+++ osgVisual/src/core/visual_core.cpp	(revision 70)
@@ -82,5 +82,5 @@
 	#else
 		OSG_NOTIFY( osg::ALWAYS ) << "Using Sky without distortion." << std::endl;
-		sky->init(rootNode);
+		sky->init(NULL, rootNode);
 	#endif
 #endif
@@ -111,4 +111,5 @@
 		// next frame please....
         viewer->advance();
+		std::cout << "New frame----------------------------" << std::endl;
 
 		/*double hat, hot, lat, lon, height;
@@ -117,7 +118,10 @@
 			OSG_NOTIFY( osg::ALWAYS ) << "HOT is: " << hot << ", HAT is: " << hat << std::endl;*/
 	
+		// perform all queued events
+		viewer->eventTraversal();
+
 		// update the scene by traversing it with the the update visitor which will
         // call all node update callbacks and animations.
-        viewer->eventTraversal();
+        
         viewer->updateTraversal();
 		
Index: osgVisual/src/dataIO/dataIO_transportContainer.cpp
===================================================================
--- osgVisual/src/dataIO/dataIO_transportContainer.cpp	(revision 69)
+++ osgVisual/src/dataIO/dataIO_transportContainer.cpp	(revision 70)
@@ -27,4 +27,5 @@
 	ADD_INT_SERIALIZER( FrameID, 0 );
 	ADD_MATRIXD_SERIALIZER( ViewMatrix, osg::Matrixd() );
+	ADD_MATRIXD_SERIALIZER( ProjectionMatrix, osg::Matrixd() );
 	ADD_LIST_SERIALIZER( Executer, osgVisual::dataIO_transportContainer::executerList );
 	ADD_LIST_SERIALIZER( IOSlots, osgVisual::dataIO_transportContainer::slotList );
Index: osgVisual/src/dataIO/visual_dataIO.cpp
===================================================================
--- osgVisual/src/dataIO/visual_dataIO.cpp	(revision 69)
+++ osgVisual/src/dataIO/visual_dataIO.cpp	(revision 70)
@@ -103,5 +103,4 @@
 	viewer->getCamera()->setFinalDrawCallback( finalDrawCallback );
 
-
 	initialized = true;
 }
@@ -113,9 +112,11 @@
 		OSG_NOTIFY( osg::ALWAYS ) << "Shutdown visual_dataIO..." << std::endl;
 
-		viewer->getCamera()->removeEventCallback( NULL );
+		viewer->getCamera()->removeEventCallback( eventCallback );
 		eventCallback = NULL;
 		viewer->getCamera()->setFinalDrawCallback( NULL );
 		finalDrawCallback = NULL;
+		
 		viewer = NULL;
+		
 
 		if(cluster.valid())
Index: osgVisual/src/distortion/visual_distortion.cpp
===================================================================
--- osgVisual/src/distortion/visual_distortion.cpp	(revision 69)
+++ osgVisual/src/distortion/visual_distortion.cpp	(revision 70)
@@ -162,4 +162,5 @@
 {
 	// Copy Main Camera's matrixes to the PRE_RENDER Camera.
+	std::cout << "distortion updatecallback" << std::endl;
 	sceneCamera->setViewMatrix( viewer->getCamera()->getViewMatrix() );
 	sceneCamera->setProjectionMatrix( viewer->getCamera()->getProjectionMatrix() );
Index: osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp
===================================================================
--- osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp	(revision 69)
+++ osgVisual/src/sky_Silverlining/visual_skySilverLining.cpp	(revision 70)
@@ -41,4 +41,5 @@
 void visual_skySilverLining::skyUpdateCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
 {
+	std::cout << "Sky silverlining update callback" << std::endl;
 	// Check if atmosphere is initialized.
 	if (!sky->isInitialized())
@@ -166,4 +167,18 @@
 	skyDrawable = new skySilverLining_skyDrawable(viewer, sceneRoot);
 
+	if(distortedRoot)	// if distortion used:
+	{
+		int rootKids = distortedRoot->getNumChildren();
+		for (int i = 0; i < rootKids; i++)
+		{
+			osg::Node *n = distortedRoot->getChild(i);
+			osg::Camera *cam = dynamic_cast<osg::Camera*>(n);
+			if (cam && cam->getRenderOrder() == osg::Camera::PRE_RENDER)
+				sceneCamera = cam;
+		}
+	}
+	else	// if no distortion used:
+		sceneCamera = viewer->getCamera();
+
 	osg::Camera *mainCamera = viewer->getCamera();
 	if (!useProjMatrixCallback)
@@ -175,99 +190,18 @@
 		mainCamera->setProjectionMatrixAsPerspective(fovy, aspect, 2, 125000);
 	}
-
-    int rootKids = distortedRoot->getNumChildren();
-    for (int i = 0; i < rootKids; i++)
-    {
-        osg::Node *n = distortedRoot->getChild(i);
-        osg::Camera *cam = dynamic_cast<osg::Camera*>(n);
-        if (cam)
-        {
-            if (cam->getRenderOrder() == osg::Camera::PRE_RENDER)
-            {
-                cam->setClearMask(0);
-
-                osg::ref_ptr<skySilverLining_atmosphereReference> ar = new skySilverLining_atmosphereReference;
-				ar->atmosphere = atmosphere;
-                cam->setUserData(ar);
-				mainCamera->setUserData(ar);
-				sceneCamera = cam;
-
-				if (useProjMatrixCallback)
-				{
-					skySilverLining_projectionMatrixCallback *cb = new skySilverLining_projectionMatrixCallback( atmosphere, viewer->getCamera(), sceneRoot);
-					cam->setClampProjectionMatrixCallback(cb);
-					cb->setSkyDrawable(skyDrawable);
-				}
-            }
-        }
-    }
-
-	// Create and install updateCallback (for position etc.)
-	updateCallback = new skyUpdateCallback( sceneGraphRoot, sceneCamera, this );
-	this->setUpdateCallback( updateCallback );
-
-    // Use a RenderBin to enforce that the sky gets drawn first, then the scene, then the clouds
-	skyDrawable->getOrCreateStateSet()->setRenderBinDetails(-1, "RenderBin");
-
-    // Add the models
-    sceneGraphRoot->getOrCreateStateSet()->setRenderBinDetails(1, "RenderBin");
-
-    // Add the clouds (note, you need this even if you don't want clouds - it calls
-    // Atmosphere::EndFrame() )
-	cloudsDrawable = new skySilverLining_cloudsDrawable(viewer);
-	cloudsDrawable->getOrCreateStateSet()->setRenderBinDetails(99, "RenderBin");
-
-	// Add drawable to this geode to get rendered
-	this->addDrawable(skyDrawable);
-	this->addDrawable(cloudsDrawable);
-}
-
-void visual_skySilverLining::init(osg::CoordinateSystemNode *sceneGraphRoot)
-{
-	sceneRoot = sceneGraphRoot;
-
-	// Use projection matrix callback oder fixed Cullsettings?
-	bool useProjMatrixCallback = true;
-
-	// add Sky to SceneRoot
-	sceneGraphRoot->addChild( this );
-
-	// Deactivate culling for the sky node (required by the silverlining sky framework)
-	this->setCullingActive(false);
-
-	// Instantiate an Atmosphere and associate it with this camera. If you have multiple cameras
-	// in multiple contexts, be sure to instantiate seperate Atmosphere objects for each.
-    // ***IMPORTANT!**** Check that the path to the resources folder for SilverLining in SkyDrawable.cpp
-    // SkyDrawable::initializeSilverLining matches with where you installed SilverLining.
-	atmosphere = new SilverLining::Atmosphere(SILVERLINING_LICENSEE, SILVERLINING_LICENSE);
-	
-    // Add the sky (calls Atmosphere::BeginFrame and handles initialization once you're in
-    // the rendering thread)
-	skyDrawable = new skySilverLining_skyDrawable(viewer, sceneRoot);
- 
-	if (!useProjMatrixCallback)
-	{
-		viewer->getCamera()->setClearMask(0);
-		viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
-		double fovy, aspect, zNear, zFar;
-		viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, zNear, zFar);
-		viewer->getCamera()->setProjectionMatrixAsPerspective(fovy, aspect, 2, 125000);
-	}
 	else
 	{
 		cb = new skySilverLining_projectionMatrixCallback( atmosphere, viewer->getCamera(), sceneRoot);
-		viewer->getCamera()->setClampProjectionMatrixCallback(cb);
+		sceneCamera->setClampProjectionMatrixCallback(cb);
 		cb->setSkyDrawable(skyDrawable);
 	}
 
-
-    viewer->getCamera()->setClearMask(0);
-
-    osg::ref_ptr<skySilverLining_atmosphereReference> ar = new skySilverLining_atmosphereReference;
+	// append atmosphere pointer to the cameras.
+	sceneCamera->setClearMask(0);
+	osg::ref_ptr<skySilverLining_atmosphereReference> ar = new skySilverLining_atmosphereReference;
 	ar->atmosphere = atmosphere;
-    viewer->getCamera()->setUserData(ar);
-	sceneCamera = viewer->getCamera();
-
-	
+	sceneCamera->setUserData(ar);
+	mainCamera->setUserData(ar);
+
 	// Create and install updateCallback (for position etc.)
 	updateCallback = new skyUpdateCallback( sceneGraphRoot, sceneCamera, this );
