Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3326)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3327)
@@ -5,5 +5,5 @@
 ////////////
 //-- ssao + gi parameters
-#define NUM_PRECOMPUTED_SAMPLES 4096
+#define NUM_PRECOMPUTED_SAMPLES 100
 //#define NUM_SAMPLES 8
 //#define NUM_SAMPLES 16
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3326)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3327)
@@ -179,4 +179,5 @@
 			 sampler2D colors,
 			 sampler2D noiseTex,
+			 //float2 samples[NUM_PRECOMPUTED_SAMPLES],
 			 sampler2D samples,
 			 float3 normal,
@@ -204,5 +205,5 @@
 
 		const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy;
-
+		//const float2 ssaoOffset = samples[i];
 
 		////////////////////
@@ -455,4 +456,5 @@
 			uniform sampler2D noiseTex,
 			uniform sampler2D samples,
+			//uniform float2 samples[NUM_PRECOMPUTED_SAMPLES],
 			uniform sampler2D oldTex,
 			uniform float4x4 modelViewProj,
@@ -511,6 +513,6 @@
 
 	const float oldSsao = temporalVals.x;
-	float oldWeight = temporalVals.y;
-	float oldIdx = temporalVals.z;
+	const float oldWeight = temporalVals.y;
+	const float oldIdx = 0;//temporalVals.z;
 
 	float3 ao;
@@ -520,9 +522,13 @@
 	{
 		if (0)
+		{
 			ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject);
+		}
 		else
+		{
 			ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, 
 			           bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, 
 					   isMovingObject, normals, oldIdx);
+		}
 	}
 	else
@@ -574,9 +580,11 @@
 	OUT.illum_col.w = eyeSpaceDepth;
 
+	//if (OUT.illum_col.z > 1000) OUT.illum_col.z = 0;
+
 	// this value can be used to check if this pixel belongs to a moving object
 	OUT.col.x = SqrLen(diffVec);
 	//OUT.illum_col.z = SqrLen(diffVec);
 
-	OUT.illum_col.xyz = normal.xyz;
+	//OUT.illum_col.xyz = normal.xyz;
 	return OUT;
 }
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3326)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg	(revision 3327)
@@ -249,6 +249,7 @@
 	}
 
-	//OUT.illum_col.xyz = float3(col.w * 5e-3f, 0, 0);
-	OUT.illum_col.xyz = ao.xyz;
+	//OUT.illum_col.xyz = float3(ao.w * 5e-3f, 0, 0);
+	//OUT.illum_col.xyz = float3(ao.y * 1e-2f, 0, 0);
+	//OUT.illum_col.xyz = ao.xyz;
 
 	OUT.illum_col.w = col.w;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 3219)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 3327)
@@ -105,6 +105,9 @@
 
 SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox, 
-					   RenderTraverser *renderer, RenderState *state): 
-mSceneBox(sceneBox), mDepth(NULL), mRenderState(state)
+					   RenderTraverser *renderer, 
+					   RenderState *state): 
+mSceneBox(sceneBox), 
+mDepth(NULL), 
+mRenderState(state)
 {
 	Prepare(renderer);
@@ -118,5 +121,4 @@
 
 	const float d = mDepth[px + py * texHeight];
-
 	static float depth = d;
 
@@ -147,4 +149,5 @@
 
 	FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true);
+
 	fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 
 		                ColorBufferObject::WRAP_CLAMP_TO_EDGE, 
@@ -177,7 +180,5 @@
 	orthoCam->SetupViewProjection();
 
-	//glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z); 
 	glMatrixMode(GL_MODELVIEW);
-	//orthoCam->SetupCameraView();
 
 	mDepth = new float[texHeight * texWidth];
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3326)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3327)
@@ -165,4 +165,19 @@
 		}
 	}
+}
+
+
+static float *GrabTexture(GLuint tex, int w, int h)
+{
+	glBindTexture(GL_TEXTURE_2D, tex);
+
+	float *data = new float[w * h * 3];
+
+	glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, data);
+
+	glBindTexture(GL_TEXTURE_2D, 0);
+	glDisable(GL_TEXTURE_2D);
+
+	return data;
 }
 
@@ -772,4 +787,5 @@
 		tempSamples[i] = samples2[ns];
 		currentSample = samples2[ns];
+
 		checked[ns] = true;
 	}
@@ -838,10 +854,24 @@
 		}
 
+
 		//if (mSortSamples) { SortSamples(); }
 		//sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES);
 		//sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES);
-		sCgSsaoProgram->SetTexture(i, sampleTex2D);
-	}
-	
+	}
+
+	sCgSsaoProgram->SetTexture(i, sampleTex2D);
+
+	static int dummycount = 0;
+
+	if (0)//dummycount ++ % 1000 == 0)
+	{
+		float *data = GrabTexture(sampleTex2D, NUM_PRECOMPUTED_SAMPLES, 1);
+		cout << "********************************" << endl;
+		for (int i = 0; i < NUM_PRECOMPUTED_SAMPLES; ++ i)
+			cout << data[i] << " ";
+		cout << endl;
+		delete [] data;
+	}
+
 	++ i;
 
@@ -870,7 +900,5 @@
 	sCgSsaoProgram->SetValue1f(i ++, mSampleIntensity * mKernelRadius);
 
-
 	DrawQuad(sCgSsaoProgram);
-
 	glPopAttrib();
 
@@ -905,8 +933,12 @@
 	// read the second buffer, write to the first buffer
 	if (!displayFrame)
+	{
 		FlipFbos(fbo);
+	}
 	else
+	{
 		// end of the pipeline => just draw image to screen
 		FrameBufferObject::Release();
+	}
 
 	// the neighbouring texels
