Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2862)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2866)
@@ -168,5 +168,5 @@
 			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 
-			glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
+			glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, mWidth, mHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
 
 			glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, mDepthTexId, 0);
@@ -178,5 +178,6 @@
 
 
-int FrameBufferObject::AddColorBuffer(ColorBufferObject::FORMAT col, 
+int FrameBufferObject::AddColorBuffer(int w, int h,
+									  ColorBufferObject::FORMAT col, 
 									  ColorBufferObject::WRAP_TYPE wrapType, 
 									  ColorBufferObject::FILTER_TYPE filterType, 
@@ -190,5 +191,5 @@
 	int idx = (int)mColorBuffers.size();
 	ColorBufferObject *colorBuf = 
-		new ColorBufferObject(mWidth, mHeight, col, wrapType, filterType, useMipMap, useMultiSampling, idx);
+		new ColorBufferObject(w, h, col, wrapType, filterType, useMipMap, useMultiSampling, idx);
 
 	mColorBuffers.push_back(colorBuf);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2866)
@@ -104,5 +104,6 @@
 			(SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample);
 
-		// if surface normal perpenticular to view dir, the samples count less => compensate for this
+		// if surface normal perpenticular to view dir, some samples probably count less 
+		// => compensate for this
 		float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal));
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 2866)
@@ -75,11 +75,14 @@
 	pixel pix;
 
+	// save color in first render target
 	pix.col = (ambient + diffuse) * tex2D(tex, IN.texCoord.xy);
+	// save world position in second rt
 	pix.pos = IN.worldPos * maxDepth;
+	// save normal in third rt
 	pix.norm.xyz = IN.normal * 0.5f + 0.5f;
 
 	// hack: squeeze some information about ambient into the texture
 	pix.norm.w = ambient.x;
-	// hack: store projection coordinate for scaling ssao
+	// store projection coordinates with positions (used for ssao)
 	pix.pos.w = IN.projPos.w;
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg	(revision 2866)
@@ -31,5 +31,5 @@
 
 	nd -= e_barrier.x;
-	nd = step(0, nd);
+	nd = step(0.0f, nd);
 
 	float ne = saturate(dot(nd, e_weights.x));
@@ -64,5 +64,6 @@
 
 	dd = abs(2.0f * dc - dd) - e_barrier.y;
-	dd = step(dd, 0);
+	dd = step(dd, 0.0f);
+
 	float de = saturate(dot(dd, e_weights.y));
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp	(revision 2866)
@@ -78,9 +78,9 @@
 	mNewFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);
 	// the diffuse color buffer
-	mNewFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
+	mNewFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
 	
 	mOldFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);
 	// the diffuse color buffer
-	mOldFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
+	mOldFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
 	
 
@@ -284,48 +284,4 @@
 
 
-/*void SsaoShader::DisplayTexture()
-{
-	glEnable(GL_TEXTURE_2D);
-
-	glBindTexture(GL_TEXTURE_2D, mNewFbo->GetColorBuffer(0)->GetTexture());
-
-	glDisable(GL_LIGHTING);
-	
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadIdentity();
-
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();
-
-	const float offs = 0.5f;
-	glOrtho(-offs, offs, -offs, offs, 0, 1);
-	
-	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-	glBegin(GL_QUADS);
-
-	glTexCoord2f(0, 0); glVertex3f(-offs, -offs, -0.5f);
-	glTexCoord2f(1, 0); glVertex3f( offs, -offs, -0.5f);
-	glTexCoord2f(1, 1); glVertex3f( offs,  offs, -0.5f);
-	glTexCoord2f(0, 1); glVertex3f(-offs,  offs, -0.5f);
-
-	glEnd();
-
-	glEnable(GL_LIGHTING);
-	glDisable(GL_TEXTURE_2D);
-	
-	glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-
-	glMatrixMode(GL_MODELVIEW);
-	glPopMatrix();
-
-	PrintGLerror("ssao second pass");
-}*/
-
-
 void SsaoShader::ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br)
 {
@@ -364,5 +320,5 @@
 	for (int i = 0; i < mWidth * mHeight * 3; i += 3)
 	{
-		// create random samples over sphere
+		// create random samples on a circle
 		const float rx = RandomValue(0, 1);
 		const float theta = 2.0f * acos(sqrt(1.0f - rx));
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2866)
@@ -108,4 +108,8 @@
 static int texWidth = 1024;
 static int texHeight = 768;
+
+//static int texWidth = 512;
+//static int texHeight = 384;
+
 //static int texWidth = 2048;
 //static int texHeight = 2048;
@@ -530,10 +534,10 @@
 
 	// the diffuse color buffer
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
+	fbo->AddColorBuffer(texWidth, texHeight, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
 	// the positions buffer
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);
+	fbo->AddColorBuffer(512, 512, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);
 	// the normals buffer
 	//fbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);
+	fbo->AddColorBuffer(texWidth, texHeight, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);
 
 	PrintGLerror("fbo");
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp	(revision 2865)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp	(revision 2866)
@@ -42,5 +42,5 @@
 	mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);
 	// the diffuse color buffer
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
+	mFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2862)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2866)
@@ -51,5 +51,6 @@
 		Returns the index that allows to retrieve the color buffer object.
 	*/
-	int AddColorBuffer(ColorBufferObject::FORMAT col, 
+	int AddColorBuffer(int w, int h,
+			           ColorBufferObject::FORMAT col, 
 		               ColorBufferObject::WRAP_TYPE wrapType, 
 					   ColorBufferObject::FILTER_TYPE filterType, 
