Index: experimental/distortionNG/DistortionSetupStrategyProjectSyntropy.cpp
===================================================================
--- experimental/distortionNG/DistortionSetupStrategyProjectSyntropy.cpp	(revision 379)
+++ experimental/distortionNG/DistortionSetupStrategyProjectSyntropy.cpp	(revision 382)
@@ -95,7 +95,5 @@
 					frustumValues[j]=atof(const_cast<char*>(valueString.c_str()));
 				}
-
-			}
-
+			}
 		}
 		inputFile.close();
@@ -168,7 +166,6 @@
 }
 
-int DistortionSetupStrategyProjectSyntropy::readMeshPointsFromCSVFile(std::string filePath, osg::Vec2Array* meshPointsVec2, osg::Vec3Array* meshPointsVec3, int displayWidth, int displayHeight)
-{
-
+int DistortionSetupStrategyProjectSyntropy::readMeshPointsFromCSVFile(std::string filePath, osg::Vec2Array* tmpMesh)
+{
 	int numValues=6;
 	std::string line, valueString;
@@ -211,19 +208,7 @@
 				}
 
-				// Insertion of Values U and V (corresponding to values[2],values[3] in a temporary Array
-				// which is returned and merged into distortionSet later
- 
-				if((_distortionType==TEXCOORDDISTORTION) || (_distortionType==COMBINEDDISTORTION))
-				{
-					tempVec2.set(values[2],values[3]);
-					meshPointsVec2->push_back(tempVec2);
-				}
-				if((_distortionType==VERTEXDISTORTION) || (_distortionType==COMBINEDDISTORTION))
-				{
-					tempVec3.set(values[2]*displayWidth,values[3]*displayHeight,0.0);
-					meshPointsVec3->push_back(tempVec3);
-				}
-			}
-
+				// Store values into array
+				tmpMesh->push_back(osg::Vec2(values[2], values[3]));
+			}
 		}
 		inputFile.close();
@@ -237,9 +222,4 @@
 	return 0;
 }
-
-
-
-
-
 
 void DistortionSetupStrategyProjectSyntropy::delegateDistortionSetup(osgViewer::DistortionSet* distortionSet)
@@ -322,5 +302,5 @@
 		distortionSet->setViewOffset(viewOffset);
 		distortionSet->setProjectionOffset(projectionOffset);
-return;
+
 		// ******************************* //
 		// ******* Distortion Mesh ******* //
@@ -334,31 +314,30 @@
 			//***    both Arrays are listed in "HorizontalLine-after-HorizontalLine" order,           ***//
 			//***    sorted from topleft (0,0,0 vertices; 0,0 texcoords) to bottomright               ***//
-			//***    (1920,1080,0 vertices; 1,1 texcoords)						  ***//
+			//***    (1920,1080,0 vertices; 1,1 texcoords)											  ***//
 			//*******************************************************************************************//
 			
-			if(0)
-			{
-				osg::Vec3Array* vertices =  (osg::Vec3Array*) distortionMeshGeometry->getVertexArray();
-				osg::Vec2Array* texcoords0 = (osg::Vec2Array*) distortionMeshGeometry->getTexCoordArray(0);
-
-				for (osg::Vec3Array::iterator it = vertices->begin(); it != vertices->end(); ++it)
-				{
-					OSG_ALWAYS<<"Vertice "<<(*it).x()<<" "<<(*it).y()<<" "<<(*it).z()<<std::endl;
-				}
-
-				for (osg::Vec2Array::iterator it = texcoords0->begin(); it != texcoords0->end(); ++it)
-				{
-					OSG_ALWAYS<<"Texcoord "<<(*it).x()<<" "<<(*it).y()<<std::endl;
-				}
-			}
+#if 1
+			osg::Vec3Array* vertices =  (osg::Vec3Array*) distortionMeshGeometry->getVertexArray();
+			osg::Vec2Array* texcoords0 = (osg::Vec2Array*) distortionMeshGeometry->getTexCoordArray(0);
+
+			for (osg::Vec3Array::iterator it = vertices->begin(); it != vertices->end(); ++it)
+			{
+				OSG_ALWAYS<<"Vertice "<<(*it).x()<<" "<<(*it).y()<<" "<<(*it).z()<<std::endl;
+			}
+
+			for (osg::Vec2Array::iterator it = texcoords0->begin(); it != texcoords0->end(); ++it)
+			{
+				OSG_ALWAYS<<"Texcoord "<<(*it).x()<<" "<<(*it).y()<<std::endl;
+			}
+#endif
 
 			//*******************************************************************************************//
-			//***    MESH WARPING	 								  ***//
+			//***    MESH WARPING	 																  ***//
 			//***    Both Vertex Warping and Texcoord Warping is supported. Although there might      ***//
 			//***    be a preferred version for osgvisual, both options should be implemented in osg  ***//
 			//*******************************************************************************************//
 
+			// Exctract mesh dimensions from file and pass them to the container
 			int distortionMeshRows=0, distortionMeshColumns=0;
-
 			readMeshDimensionsFromCSVFile(_distortionFilename, &distortionMeshRows, &distortionMeshColumns);
 
@@ -366,23 +345,28 @@
 			distortionSet->setDistortionMeshColumns(distortionMeshColumns);
 
-			osg::Vec2Array* distortionMeshVec2 = new osg::Vec2Array;
-			osg::Vec3Array* distortionMeshVec3 = new osg::Vec3Array;
+			osg::Vec2Array* tmpMeshVec2 = new osg::Vec2Array;
+			osg::Vec3Array* vertexMeshVec3 = new osg::Vec3Array;
+
+			readMeshPointsFromCSVFile(_distortionFilename, tmpMeshVec2);
 
 			if((_distortionType==TEXCOORDDISTORTION) || (_distortionType==COMBINEDDISTORTION))
 			{
-				readMeshPointsFromCSVFile(_distortionFilename, distortionMeshVec2, distortionMeshVec3, width, height);
-				distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setTexCoordArray(0,distortionMeshVec2);
+				distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setTexCoordArray(0,tmpMeshVec2);
 			}
 
 			if((_distortionType==VERTEXDISTORTION) || (_distortionType==COMBINEDDISTORTION))
 			{
-				readMeshPointsFromCSVFile(_distortionFilename, distortionMeshVec2, distortionMeshVec3, width, height);
-				distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setVertexArray(distortionMeshVec3);
-
-			}
-
+				for(unsigned int i=0;i<tmpMeshVec2->size();i++)
+				{
+					// Scale vector with the screen resolution
+					osg::Vec3 tmpVec = osg::Vec3(	tmpMeshVec2->at(i).x()*width,
+													tmpMeshVec2->at(i).y()*height,
+													0.0	);
+					vertexMeshVec3->push_back( tmpVec );
+				}
+				distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setVertexArray(vertexMeshVec3);
+
+			}
 		}
-
-	}
-
-}
+	}
+}
