Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2795)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2823)
@@ -16,8 +16,14 @@
 class Geometry
 {
+friend class ResourceManager;
+
 public:
 	/** Constructor taking an array of triangles.
 	*/
-	Geometry(Vector3 *vertices, Vector3 *normals, float *texcoords, int numVertices, bool delData);
+	Geometry(Vector3 *vertices, 
+		     Vector3 *normals, 
+			 float *texcoords, 
+			 int numVertices, 
+			 bool delData);
 
 	~Geometry();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2818)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2823)
@@ -30,4 +30,6 @@
 	if (mMaterial) mMaterial->Render(state);
 
+	static Matrix4x4 identity = IdentityMatrix();
+
 	if (mTransform)
 	{
@@ -37,11 +39,9 @@
 		mGeometry->Render(state);
 
+		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)identity.x);
 		//glPopMatrix();
 	}
 	else
 	{
-		static Matrix4x4 identity = IdentityMatrix();
-
-		cgGLSetMatrixParameterfc(sModelMatrixParam, (const float *)identity.x);
 		mGeometry->Render(state);
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2822)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2823)
@@ -82,6 +82,6 @@
 
 /// these values get scaled with the frame rate
-const static float keyForwardMotion = 50.0f;
-const static float keyRotation = 2.0f;
+const static float keyForwardMotion = 30.0f;
+const static float keyRotation = 1.5f;
 
 /// elapsed time in seconds
@@ -503,8 +503,4 @@
 		sColorsTexParam = cgGetNamedParameter(sCgDeferredProgram, "colors");  
 		sNormalsTexParam = cgGetNamedParameter(sCgDeferredProgram, "normals");  
-		//sNoiseTexParam = cgGetNamedParameter(sCgDeferredProgram, "noiseTexture");
-
-		//sSamplesParam = cgGetNamedParameter(sCgDeferredProgram, "samples");
-		//cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples);
 	}
 	else
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2822)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2823)
@@ -96,5 +96,5 @@
     
     //sample noisetex; r stores costheta, g stores sintheta
-    float2 noise = tex2D(noiseTexture, IN.texCoord.xy).xy * 2.0f - 1.0f;
+    float2 noise = tex2D(noiseTexture, IN.texCoord.xy * 7.0f).xy * 2.0f - 1.0f;
 	
     // rotation
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2817)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2823)
@@ -6,4 +6,6 @@
 #include "Texture.h"
 #include "gzstream.h"
+#include "Matrix4x4.h"
+#include "Vector3.h"
 
 
@@ -41,7 +43,10 @@
 	Matrix4x4 *trafo;
 	
+	SceneEntity *sceneGeom;
+
 	if (!hasTrafo)
 	{
 		trafo = NULL;
+		sceneGeom = new SceneEntity(geom, mat, trafo);
 	}
 	else
@@ -50,7 +55,22 @@
 		str.read(reinterpret_cast<char *>(trafo->x), sizeof(Matrix4x4));
 		mTrafos.push_back(trafo);
-	}
-
-	SceneEntity *sceneGeom = new SceneEntity(geom, mat, trafo);
+#if 0 // use instancing
+		Vector3 *vertices = new Vector3[geom->mNumVertices];
+
+		for (int i = 0; i < geom->mNumVertices; ++ i)
+		{
+			Vector3 v = geom->mVertices[i];
+
+			v = (*trafo) * v;
+			vertices[i] = v;
+		}
+
+		Geometry *tgeom = new Geometry(vertices, geom->mNormals, geom->mTexCoords, geom->mNumVertices, false);
+
+		sceneGeom = new SceneEntity(tgeom, mat, NULL);
+#else
+		sceneGeom = new SceneEntity(geom, mat, trafo);
+#endif
+	}
 
 	return sceneGeom;
@@ -175,5 +195,6 @@
 	}
 
-	return new Geometry(vertices, normals, texcoords, vertexCount, true);
+	//return new Geometry(vertices, normals, texcoords, vertexCount, true);
+	return new Geometry(vertices, normals, texcoords, vertexCount, false);
 }
 
