Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h	(revision 2840)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.h	(revision 2889)
@@ -46,10 +46,9 @@
 	void SetFrameId(int frameId);
 
-protected:
-
-	/** Renders a camera frustum.
+		/** Renders a camera frustum.
 	*/
 	void RenderFrustum();
 
+protected:
 
 	////////////
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2888)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2889)
@@ -11,6 +11,6 @@
 	 // normalized screen position
 	float4 pos: WPOS;
-	float4 texCoord: TEXCOORD0; 
-	float3 view: COLOR0;
+	float2 texCoord: TEXCOORD0; 
+	float3 view: TEXCOORD1;
 };
 
@@ -95,6 +95,5 @@
 
 	//return max(0.0f, 1.0f - total_ao);
-	//return saturate(dot(currentViewDir, currentNormal));
-	return saturate(dot(currentViewDir, float3(0, -1, 0)));
+	return saturate(dot(currentViewDir, currentNormal));
 }
 
@@ -125,5 +124,6 @@
 	float3 normal = normalize(norm.xyz);
 	/// the current view direction
-	float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f));
+	//float3 viewDir = normalize(IN.view * 2.0f - float3(1.0f));
+	float3 viewDir = IN.view;
 
 	// the current world position
@@ -166,4 +166,5 @@
 	}
 
+	//OUT.illum_col.xyz = viewDir;
 	OUT.illum_col.w = currentDepth;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2862)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2889)
@@ -226,4 +226,15 @@
 	}
 	
+#if 0
+	// construct normals
+	for (int i = 0; i < vertexCount; i += 3)
+	{
+		Triangle3 tri(vertices[i], vertices[i + 1], vertices[i + 2]);
+
+		normals[i] = tri.GetNormal();
+		normals[i+1] = tri.GetNormal();
+		normals[i+2] = tri.GetNormal();
+	}
+#endif
 
 	return new Geometry(vertices, normals, texcoords, vertexCount, true);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2888)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2889)
@@ -139,5 +139,4 @@
 	orthoCam->SetDirection(Vector3(0, 0, -1));
 
-	cout << orthoCam->GetDirection() << endl;
 	Vector3 pos = Vector3(mSceneBox.Center().x, mSceneBox.Center().y, mSceneBox.Max().z);
 	orthoCam->SetPosition(pos);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2888)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2889)
@@ -540,6 +540,4 @@
 	ComputeViewVectors(tl, tr, bl, br);
 
-	glColor3f(1.0f, 1.0f, 1.0f);
-
 	glBegin(GL_QUADS);
 
@@ -547,9 +545,14 @@
 	//const float new_offs = 0.55f;
 	const float new_offs = 0.5f;
-	
-	glColor3f(bl.x, bl.y, bl.z); glTexCoord2f(0, 0); glVertex3f(-new_offs, -new_offs, -0.5f);
-	glColor3f(br.x, br.y, br.z); glTexCoord2f(1, 0); glVertex3f( new_offs, -new_offs, -0.5f);
-	glColor3f(tr.x, tr.y, tr.z); glTexCoord2f(1, 1); glVertex3f( new_offs,  new_offs, -0.5f);
-	glColor3f(tl.x, tl.y, tl.z); glTexCoord2f(0, 1); glVertex3f(-new_offs,  new_offs, -0.5f);
+	/*
+	glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f(-new_offs, -new_offs, -0.5f);
+	glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f( new_offs, -new_offs, -0.5f);
+	glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f( new_offs,  new_offs, -0.5f);
+	glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f(-new_offs,  new_offs, -0.5f);
+*/
+	glTexCoord2f(0, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tr.x, tr.y, tr.z); glVertex3f(-new_offs, -new_offs, -0.5f);
+	glTexCoord2f(1, 0); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, tl.x, tl.y, tl.z); glVertex3f( new_offs, -new_offs, -0.5f);
+	glTexCoord2f(1, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, bl.x, bl.y, bl.z); glVertex3f( new_offs,  new_offs, -0.5f);
+	glTexCoord2f(0, 1); glMultiTexCoord3fARB(GL_TEXTURE1_ARB, br.x, br.y, br.z); glVertex3f(-new_offs,  new_offs, -0.5f);
 
 	glEnd();
@@ -574,5 +577,5 @@
 	mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr);
 
-#if 1 // matT: debug this!!
+#if 1
 	
 	bl = Normalize(nbl - fbl);
@@ -590,9 +593,9 @@
 #endif
 
-	// normalize to 0 .. 1
-	bl = bl * 0.5f + 0.5f;
+	// pack into 0 .. 1
+	/*bl = bl * 0.5f + 0.5f;
 	br = br * 0.5f + 0.5f;
 	tl = tl * 0.5f + 0.5f;
-	tr = tr * 0.5f + 0.5f;
+	tr = tr * 0.5f + 0.5f;*/
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2864)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Visualization.cpp	(revision 2889)
@@ -164,4 +164,5 @@
 	mCamera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr);
 
+	//mCamera->SetF
 	glLineWidth(2);
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2887)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2889)
@@ -65,4 +65,6 @@
 	void AntiAliasing(FrameBufferObject *fbo);
 
+	/** Helper method that computes the view vectors in the corners of the current view frustum.
+	*/
 	void ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br);
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2888)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2889)
@@ -332,11 +332,5 @@
 	camera->SetFar(1000);
 
-	cout << "here2 " << Normalize(camDir) << endl;
-
 	camera->SetDirection(camDir);
-
-	cout << "here3 " << camera->GetDirection() << endl;
-	cout << "here3 " << camera->GetRightVector() << endl;
-	cout << "here3 " << camera->GetUpVector() << endl;
 
 	camera->SetPosition(camPos);
@@ -1570,4 +1564,46 @@
 	glMatrixMode(GL_MODELVIEW);
 	glPopMatrix();
+
+	Vector3 ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr;
+
+	camera->ComputePoints(ftl, ftr, fbl, fbr, ntl, ntr, nbl, nbr);
+
+	Vector3 bl, br, tl, tr;
+
+	bl = Normalize(nbl - fbl) * 100;
+	br = Normalize(nbr - fbr) * 100;
+	tl = Normalize(ntl - ftl) * 100;
+	tr = Normalize(ntr - ftr) * 100;
+
+	Vector3 dum = pos + camera->GetDirection() * 20;
+
+	// coordinates
+	glColor3f(0.0f, 1.0f, 0.0f);
+
+	glBegin(GL_LINES);
+	glVertex3d(dum.x, dum.y, dum.z);
+	glVertex3d(dum.x + bl.x, dum.y + bl.y, dum.z + bl.z);
+	glEnd();
+
+/*	glColor3f(1.0f, 0.0f, 0.0f);
+
+	glBegin(GL_LINES);
+	glVertex3d(dum.x, dum.y, dum.z);
+	glVertex3d(dum.x + br.x, dum.y + br.y, dum.z + br.z);
+	glEnd();
+
+*/	glColor3f(0.0f, 0.0f, 1.0f);
+
+	glBegin(GL_LINES);
+	glVertex3d(dum.x, dum.y, dum.z);
+	glVertex3d(dum.x + tl.x, dum.y + tl.y, dum.z + tl.z);
+	glEnd();
+/*
+	glColor3f(1.0f, 0.0f, 1.0f);
+
+	glBegin(GL_LINES);
+	glVertex3d(dum.x, dum.y, dum.z);
+	glVertex3d(dum.x + tr.x, dum.y + tr.y, dum.z + tr.z);
+	glEnd();*/
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 2888)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.cpp	(revision 2889)
@@ -175,7 +175,10 @@
 	float z_far = mFar;
 
-	const float w_near = 2.0f * tan(mFovy / 2) * z_near;
+	float fov = 120 * M_PI / 180.0f;//mFovy;
+
+	const float w_near = 2.0f * tan(fov * 0.5f) * z_near;
 	const float h_near = w_near / GetAspect();
-	const float w_far = 2.0f * tan(mFovy / 2) * z_far;
+
+	const float w_far = 2.0f * tan(fov * 0.5f) * z_far;
 	const float h_far = w_far / GetAspect();
 
@@ -183,6 +186,6 @@
 	const Vector3 fc = mPosition + view * z_far; 
 	
-	const Vector3 up = GetUpVector();
-	const Vector3 right = GetRightVector();
+	const Vector3 up = -GetUpVector();
+	const Vector3 right = -GetRightVector();
 
 	Vector3 t1, t2;
