Index: experimental/distortionNG/extViewer.cpp
===================================================================
--- experimental/distortionNG/extViewer.cpp	(revision 334)
+++ experimental/distortionNG/extViewer.cpp	(revision 335)
@@ -31,4 +31,28 @@
 {
 
+}
+
+static osg::Texture* 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::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST);
+            texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST);
+            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;
 }
 
@@ -100,6 +124,4 @@
 		geom->setTexCoordArray(1,texcoords1);
 
- //   osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES);
- //   geometry->addPrimitiveSet(elements);
 
 	for ( unsigned int row=0; row<rows-1; row++ )	// each strip consists of two affected vertex rows, so we need only row-1 strips.
@@ -114,23 +136,23 @@
 	}
 
-	if (intensityMap && !applyIntensityMapAsColours)
-	{
-		// create shaders for distortion
-		osg::Program* distortProgram = new osg::Program;
-		distortProgram->setName( "distortion" );
-		osg::Shader* vShader = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" ); 
-		vShader->setName("intensityMapVertShader");
-		osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" ); 
-		fShader->setName("intensityMapFragShader");
-
-		if ( vShader && fShader )
-		{
-			//distortProgram->addShader( vShader );
-			distortProgram->addShader( fShader );
-			geom->getOrCreateStateSet()->addUniform( new osg::Uniform("sceneTexture", 0) );
-			geom->getOrCreateStateSet()->addUniform( new osg::Uniform("intensityMapTexture", 1) );
-			geom->getOrCreateStateSet()->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
-		}
-	}
+	//if (intensityMap && !applyIntensityMapAsColours)
+	//{
+	//	// create shaders for distortion
+	//	osg::Program* distortProgram = new osg::Program;
+	//	distortProgram->setName( "distortion" );
+	//	osg::Shader* vShader = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" ); 
+	//	vShader->setName("intensityMapVertShader");
+	//	osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" ); 
+	//	fShader->setName("intensityMapFragShader");
+
+	//	if ( vShader && fShader )
+	//	{
+	//		//distortProgram->addShader( vShader );
+	//		distortProgram->addShader( fShader );
+	//		geom->getOrCreateStateSet()->addUniform( new osg::Uniform("sceneTexture", 0) );
+	//		geom->getOrCreateStateSet()->addUniform( new osg::Uniform("intensityMapTexture", 1) );
+	//		geom->getOrCreateStateSet()->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
+	//	}
+	//}
 
 	return geom.release();
@@ -240,10 +262,10 @@
         // StateSet to contain the Texture StateAttribute.
         osg::StateSet* stateset = geode->getOrCreateStateSet();
-        stateset->setTextureAttributeAndModes(0, sceneTexture,osg::StateAttribute::ON);
-        stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
-
-		osg::TexMat* texmat = new osg::TexMat;
-        texmat->setScaleByTextureRectangleSize(true);
-        stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
+        //stateset->setTextureAttributeAndModes(0, sceneTexture,osg::StateAttribute::ON);
+        //stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
+
+		//osg::TexMat* texmat = new osg::TexMat;
+  //      texmat->setScaleByTextureRectangleSize(true);
+  //      stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
 
 		// If the intensityMap is used but not applyIntensityMapAsColours: Apply intensityMap as intensityMapTexture on unit 1
@@ -257,8 +279,39 @@
 
             stateset->setTextureAttributeAndModes(1, intensityMapTexture, osg::StateAttribute::ON);
+
+			osg::Texture* tmp = loadTexture( "test.jpg" );
+			if(tmp)
+			{
+				stateset->setTextureAttributeAndModes(0, tmp,osg::StateAttribute::ON);
+
+				osg::TexMat* texmat = new osg::TexMat;
+				texmat->setScaleByTextureRectangleSize(true);
+				stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
+			}
+
         }
 
 		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);
 		geode->addDrawable(distortionMesh);
+
+		if (intensityMap && !applyIntensityMapAsColours)
+		{
+			// create shaders for distortion
+			osg::Program* distortProgram = new osg::Program;
+			distortProgram->setName( "distortion" );
+			osg::Shader* vShader = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" ); 
+			vShader->setName("intensityMapVertShader");
+			osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" ); 
+			fShader->setName("intensityMapFragShader");
+
+			if ( vShader && fShader )
+			{
+				//distortProgram->addShader( vShader );
+				distortProgram->addShader( fShader );
+				stateset->addUniform( new osg::Uniform("sceneTexture", 0) );
+				stateset->addUniform( new osg::Uniform("intensityMapTexture", 1) );
+				stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
+			}
+		}
 
 
Index: experimental/distortionNG/shader.frag
===================================================================
--- experimental/distortionNG/shader.frag	(revision 334)
+++ experimental/distortionNG/shader.frag	(revision 335)
@@ -1,6 +1,6 @@
 uniform sampler2D sceneTexture;
 uniform sampler2D intensityMapTexture;
-varying vec2 texcoord_scene;
-varying vec2 texcoord_intensityMap;
+in varying vec2 texcoord_scene;
+in varying vec2 texcoord_intensityMap;
 
 void main(void)
Index: experimental/distortionNG/shader.vert
===================================================================
--- experimental/distortionNG/shader.vert	(revision 334)
+++ experimental/distortionNG/shader.vert	(revision 335)
@@ -1,9 +1,8 @@
-varying vec2 texcoord_scene;
-varying vec2 texcoord_intensityMap;
+out varying vec2 texcoord_scene;
+out varying vec2 texcoord_intensityMap;
 
 void main()
 {
 	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-	gl_FrontColor = gl_Color;
 	texcoord_scene = vec2(gl_MultiTexCoord0);
 	texcoord_intensityMap = vec2(gl_MultiTexCoord1);
