Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2874)
@@ -63,8 +63,9 @@
 	float3 normal = normalize(norm.xyz);// * 2.0f - float4(1.0f));
 
-	float4 col = shade(IN, color, position, normal.xyz, amb);
+	float4 col = shade(IN, color, position, normal, amb);
 	
 	//OUT.color = float4(1.0f);
 	OUT.color = col;
+	OUT.color.w = color.w;
 
 	return OUT;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2874)
@@ -151,4 +151,5 @@
 	realPos.w = 1.0f;
 
+	// reproject
 	float4 oldPos = mul(oldModelViewProj, realPos);
 
@@ -176,5 +177,6 @@
 	OUT.illum_col.w = currentDepth;
 
-	
+	//OUT.combined_col = float4(newDepth / oldDepth * 100, 0, 0, 1) ;
+	//OUT.combined_col = float4(newDepth, 0, 0, 1) ;
 
 	return OUT;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2874)
@@ -106,5 +106,4 @@
 mScaleFactor(scaleFactor)
 {
-	
 	///////////
 	//-- the flip-flop fbos
@@ -222,5 +221,5 @@
 		sNoiseMultiplierGiParam = cgGetNamedParameter(sCgGiProgram, "noiseMultiplier");
 		
-		sOldModelViewProjMatrixParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj");
+		sOldModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj");
 		sMaxDepthGiParam = cgGetNamedParameter(sCgGiProgram, "maxDepth");
 		sExpFactorGiParam = cgGetNamedParameter(sCgGiProgram, "expFactor");
@@ -272,5 +271,4 @@
 	swap(mNewFbo, mOldFbo);	
 
-	cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x);
 
 	glPushAttrib(GL_VIEWPORT_BIT);
@@ -300,6 +298,6 @@
 	FirstPass(fbo);
 	
-	ComputeSsao(fbo, expFactor);
-	//ComputeGlobIllum(fbo, expFactor);
+	//ComputeSsao(fbo, expFactor, oldProjViewMatrix);
+	ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix);
 
 	//Combine(fbo);
@@ -321,6 +319,11 @@
 
 
-void SsaoShader::ComputeSsao(FrameBufferObject *fbo, float expFactor)
-{
+void SsaoShader::ComputeSsao(FrameBufferObject *fbo, 
+							 float expFactor,
+							 const Matrix4x4 &oldProjViewMatrix
+							 )
+{
+	cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x);
+
 	GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture();
 	GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture();
@@ -582,6 +585,11 @@
 
 
-void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo, float expFactor)
-{
+void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo, 
+								  float expFactor,
+								  const Matrix4x4 &oldProjViewMatrix
+								  )
+{
+	cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x);
+
 	GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture();
 	GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture();
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h	(revision 2874)
@@ -22,5 +22,5 @@
 {
 public:
-	/** constructor for a deferred shader taking the requested output image size,
+	/** Constructor for a deferred shader taking the requested output image size,
 		the current camera,	and a scaling factor.
 			
@@ -30,7 +30,5 @@
 	*/
 	SsaoShader(int w, int h, Camera *cam, float scaleFactor);
-	/** 
-	
-		The algorithm renders the scene given an fbo consists of 1 color buffer, 
+	/** The algorithm renders the scene given an fbo consists of 1 color buffer, 
 		1 position buffer, and 1 normal buffer.
 		We also need the  projection view matrix of the last frame for reprojection, and
@@ -46,9 +44,11 @@
 	~SsaoShader();
 
+	void SetType(bool useGlobIllum, bool useTemporalCoherence);
+
 protected:
 
-	void ComputeSsao(FrameBufferObject *fbo, float expFactor);
+	void ComputeSsao(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix);
 
-	void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor);
+	void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix);
 
 	void FirstPass(FrameBufferObject *fbo);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2873)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2874)
@@ -539,6 +539,6 @@
 
 	// the diffuse color buffer
-	//fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true);
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false);
+	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true);
+	//fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false);
 
 	// the positions buffer
