Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h	(revision 2932)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.h	(revision 2934)
@@ -161,4 +161,5 @@
 Matrix4x4 LookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up);
 Matrix4x4 MyLookAt(const Vector3 &pos, const Vector3 &dir, const Vector3& up);
+Matrix4x4 MyLookAt2(const Vector3 &pos, const Vector3 &dir, const Vector3& up);
 
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp	(revision 2933)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp	(revision 2934)
@@ -89,5 +89,5 @@
 	{
 		mCullFaceEnabled = true;
-		//glEnable(GL_CULL_FACE);
+		glEnable(GL_CULL_FACE);
 	}
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2933)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2934)
@@ -23,5 +23,5 @@
 static Polyhedron *polyhedron = NULL;
 static Polyhedron *lightPoly = NULL;
-static Matrix4x4 dummy = IdentityMatrix();
+static Vector3 dummyPt;
 
 
@@ -185,12 +185,8 @@
 	DrawPoly(polyhedron, Vector3(0, 1, 0));
 
-	Vector3 pt = Vector3::ZERO();
-
-	pt = dummy * pt;
-
 	glPointSize(10.0f);
 
 	glBegin(GL_POINTS);
-	glVertex3f(pt.x, pt.y, pt.z);
+	glVertex3f(dummyPt.x, dummyPt.y, dummyPt.z);
 	glEnd();
 }
@@ -223,6 +219,6 @@
 	//-- first find the free parameter values n, and P (the projection center), and the projection depth
 
-	const float n = 1e3f;
-	//const float n = 1e6f;
+	//const float n = 1e1f;
+	const float n = 1e6f;
 	//const float n = ComputeN(bounds_ls) * 100;
 
@@ -244,4 +240,5 @@
 
 	cout <<"start: " << startPt << " " << projCenter << " " << Distance(lightSpace * mCamera->GetPosition(), startPt) << endl;
+dummyPt = -projCenter;
 
 	//construct a translation that moves to the projection center
@@ -408,5 +405,5 @@
 
 	transform2LispSM.x[0][0] =  1.0f;
-	transform2LispSM.x[1][2] = -1.0f; // y => -z
+	transform2LispSM.x[1][2] =  -1.0f; // y => -z
 	transform2LispSM.x[2][1] =  1.0f; // z => y
 	transform2LispSM.x[3][3] =  1.0f;
@@ -424,5 +421,5 @@
 	//calculate a frame matrix that uses the projViewDir[lightspace] as up vector
 	//look(from position, into the direction of the projected direction, with unchanged up-vector)
-	const Matrix4x4 frame = MyLookAt(Vector3::ZERO(), projViewDir, Vector3::UNIT_Y());
+	const Matrix4x4 frame = MyLookAt2(Vector3::ZERO(), -projViewDir, Vector3::UNIT_Y());
 	//const Matrix4x4 frame = MyLookAt(Vector3::ZERO(), projViewDir, Vector3::UNIT_Z());
 
@@ -442,5 +439,5 @@
 	transformToGL.x[0][0] =  1.0f;
 	transformToGL.x[1][2] =  1.0f; // z => y
-	transformToGL.x[2][1] = -1.0f; // y => -z
+	transformToGL.x[2][1] =  -1.0f; // y => -z
 	transformToGL.x[3][3] =  1.0f;
 
@@ -564,6 +561,5 @@
 
 	Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir);
-	Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, -upVec);
-	//Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, mCamera->GetDirection());
+	Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec);
 
 	mShadowCam->mViewOrientation = lightView;
@@ -603,5 +599,5 @@
 
 	mLightProjView = lightView * lightProj;
-glEnable(GL_CULL_FACE);
+;
 	cout << "here3" << endl;
 	DEL_PTR(lightPoly);
@@ -676,7 +672,5 @@
 
 	Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir);
-	Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, -upVec);
-	//Matrix4x4 lightView = Invert(_lightView);
-	//Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, mCamera->GetDirection());
+	Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec);
 
 	mShadowCam->mViewOrientation = lightView;
@@ -702,5 +696,5 @@
 	mLightProjView = lightView * lightProj;
 
-	dummy = mLightProjView;
+	//dummy = mLightProjView;
 
 	DEL_PTR(lightPoly);
@@ -711,5 +705,5 @@
 	glLoadIdentity();
 
-	glDisable(GL_CULL_FACE);
+	//glDisable(GL_CULL_FACE);
 
 	mShadowCam->SetupCameraView();
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2933)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2934)
@@ -742,8 +742,4 @@
 	Matrix4x4 m(nRight, nUp, -nDir);
 
-	/*m.x[3][0] = -DotProd(nRight, position);
-	m.x[3][1] = -DotProd(nUp, position);
-	m.x[3][2] = -DotProd(nDir, position);*/
-
 	Vector3 position = m * -pos;
 	
@@ -756,3 +752,27 @@
 }
 
-}
+
+Matrix4x4 MyLookAt2(const Vector3 &pos, const Vector3 &dir, const Vector3& up) 
+{
+	const Vector3 nDir = Normalize(dir);
+	Vector3 nUp = Normalize(up);
+
+	Vector3 nRight = Normalize(CrossProd(nDir, nUp));
+	nUp = Normalize(CrossProd(nRight, nDir));
+
+	Matrix4x4 m(nRight, nUp, nDir);
+
+	/*m.x[3][0] = -DotProd(nRight, position);
+	m.x[3][1] = -DotProd(nUp, position);
+	m.x[3][2] = -DotProd(nDir, position);*/
+
+	Vector3 position = m * -pos;
+	
+	// note: left handed system => we go into positive z
+	m.x[3][0] = position.x;
+	m.x[3][1] = position.y;
+	m.x[3][2] = position.z;
+
+	return m;
+}
+}
