Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2939)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2940)
@@ -227,5 +227,5 @@
 										 )
 {
-	return IdentityMatrix();
+	//return IdentityMatrix();
 
 	AxisAlignedBox3 bounds_ls = GetExtremalPoints(lightSpace, body);
@@ -236,6 +236,6 @@
 
 	//const float n = 1e2f;
-	const float n = 1e6f;
-	//const float n = ComputeN(bounds_ls);
+	//const float n = 1e6f;
+	const float n = ComputeN(bounds_ls);
 
 	cout << "n: " << n << endl;
@@ -442,5 +442,5 @@
 	//look(from position, into the direction of the projected direction, with unchanged up-vector)
 	//const Matrix4x4 frame = MyLookAt2(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_Y());
 
 	cout << "frame\n " << frame << endl;
@@ -455,8 +455,8 @@
 	Matrix4x4 transformToGL = ZeroMatrix();
 	
-	transformToGL.x[0][0] =  1.0f;
-	transformToGL.x[1][2] =  1.0f; // z => y
+	transformToGL.x[0][0] =   1.0f;
+	transformToGL.x[1][2] =   1.0f; // z => y
 	transformToGL.x[2][1] =  -1.0f; // y => -z
-	transformToGL.x[3][3] =  1.0f;
+	transformToGL.x[3][3] =   1.0f;
 
 	lightProj *= transformToGL;
@@ -583,5 +583,5 @@
 
 	Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir);
-	Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec);
+	Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, upVec);
 	//Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, mCamera->GetDirection());
 
@@ -591,9 +591,4 @@
 	mShadowCam->mViewOrientation = lightView;
 
-	//cout << "here45:\n" << lightView << endl;
-
-	//mShadowCam->SetDirection(dir);
-	//mShadowCam->GetModelViewMatrix(lightView);
-	//cout << "here46:\n" << lightView << endl;
 
 	mFbo->Bind();
@@ -701,5 +696,5 @@
 
 	Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir);
-	Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec);
+	Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, upVec);
 	//Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, mCamera->GetDirection());
 
@@ -720,5 +715,4 @@
 
 	Matrix4x4 lightProj;
-	
 	CalcLightProjection(lightProj);
 
@@ -728,5 +722,4 @@
 
 	mLightProjView = lightView * lightProj;
-
 	dummyMat = mLightProjView;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2939)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2940)
@@ -772,5 +772,29 @@
 	nUp = Normalize(CrossProd(nRight, nDir));
 
-	Matrix4x4 m(nRight, nUp, -nDir);
+	Matrix4x4 m(nRight.x, nRight.y, nRight.z, 0,
+ 		        nUp.x,    nUp.y,    nUp.z,    0,
+				-nDir.x,  -nDir.y,   -nDir.z, 0,
+				0,        0,        0,        1);
+
+	Vector3 position = m * -pos;
+	
+	// note: left handed system => we go into positive z
+	m.x[3][0] = -DotProd(nRight, pos);
+	m.x[3][1] = -DotProd(nUp, pos);
+	m.x[3][2] =  DotProd(nDir, pos);
+
+	return m;
+}
+
+
+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);
 
 	Vector3 position = m * -pos;
@@ -785,19 +809,3 @@
 
 
-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, pos);
-	m.x[3][1] = -DotProd(nUp, pos);
-	m.x[3][2] = -DotProd(nDir, pos);
-
-	return m;
-}
-}
+}
