Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 3000)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg	(revision 3001)
@@ -105,16 +105,14 @@
 	const float4 projPos = IN.mypos / IN.mypos.w;
 	
-	const float2 screenCoord = projPos.xy * 0.5f + 0.5f;
-	const float magView = length(Interpol(screenCoord, bl, br, tl, tr));
-
 	// hack: squeeze some information about ambient into the texture
 	//pix.col.w = glstate.material.emission.x;
 
-	// eye linear depth
+	// compute eye linear depth
+	const float2 screenCoord = projPos.xy * 0.5f + 0.5f;
+	const float magView = length(Interpol(screenCoord, bl, br, tl, tr));
 	pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView;
 
 	// save world position in second render target
 	pix.pos = IN.worldPos * maxDepth;
-	//pix.pos.x = pix.col.w;
 	// store the projected depth
 	pix.pos.w = projPos.z;
@@ -143,14 +141,14 @@
 
 	const float4 projPos = IN.mypos / IN.mypos.w;
-	
-	float2 screenCoord = projPos.xy * 0.5f + 0.5f;
-	const float magView = length(Interpol(screenCoord, bl, br, tl, tr));
 
 	// hack: squeeze some information about the ambient term into the target
 	//pix.col.w = glstate.material.emission.x;
+	
+	// compute eye linear depth
+	float2 screenCoord = projPos.xy * 0.5f + 0.5f;
+	const float magView = length(Interpol(screenCoord, bl, br, tl, tr));
 	pix.col.w = length(eyePos - IN.worldPos.xyz) * maxDepth / magView;
 
 	pix.pos = IN.worldPos * maxDepth;
-	//pix.pos.x = pix.col.w;
 	// store the projected depth
 	pix.pos.w = projPos.z;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3000)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3001)
@@ -4,4 +4,7 @@
 // Screen Spaced Ambient Occlusion shader
 // based on shader of Alexander Kusternig
+
+
+#define USE_EYE_SPACE_DEPTH 0
 
 
@@ -48,5 +51,5 @@
 										float3 bl, float3 br, float3 tl, float3 tr)
 {
-#if 1
+#if USE_EYE_SPACE_DEPTH
 	float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w;
 	//float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr));
@@ -104,9 +107,4 @@
 		//if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f))++ numSamples;
 
-		// get sample world space position
-		float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w;
-		//float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr));
-		float3 rotView = Interpol(texcoord, bl, br, tl, tr);
-	
 		float3 samplePos = ReconstructSamplePosition(eyePos, colors, texcoord, bl, br, tl, tr);
 
@@ -170,16 +168,18 @@
 	float w = norm.w;
 
+
 	// the current world position
 	const float4 centerPosition = tex2D(positions, IN.texCoord.xy);
 
-#if 0
+#if USE_EYE_SPACE_DEPTH
 	/// reconstruct position from the eye space depth
-/*	float3 viewDir = normalize(IN.view);
+	float3 viewDir = IN.view;
 	const float eyeDepth = tex2D(colors, IN.texCoord.xy).w;
-	float4 centerPosition;
-
-	centerPosition.xyz = eyePos - viewDir * eyeDepth;
-*/
-	const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, eyePos, bl, br, tl, tr);
+	float4 centerPosition2;
+
+	centerPosition2.xyz = eyePos - viewDir * eyeDepth;
+	centerPosition2.w = centerPosition.w;
+
+	const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition2, w, eyePos, bl, br, tl, tr);
 #else
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg	(revision 3000)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg	(revision 3001)
@@ -108,5 +108,5 @@
 		//float3 rotView = normalize(Interpol(texcoord, bl, br, tl, tr));
 		float3 rotView = Interpol(texcoord, bl, br, tl, tr);
-		//float3 rotView = Interpol(texcoord, bl, br, tl, tr);
+		
 		
 		const float3 sample_position = eyePos - rotView * eyeSpaceDepth;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2965)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 3001)
@@ -139,5 +139,5 @@
 
 	FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true);
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, 
+	fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 
 		                ColorBufferObject::WRAP_CLAMP_TO_EDGE, 
 						ColorBufferObject::FILTER_NEAREST,
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2965)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 3001)
@@ -143,5 +143,5 @@
 
 	// need a color buffer to keep opengl happy
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE,
+	mFbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE,
 		                 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 
 						 ColorBufferObject::FILTER_NEAREST);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2999)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3001)
@@ -666,12 +666,12 @@
 
 	// the diffuse color buffer
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
+	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
 	// the positions buffer
-	//fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_LUMINANCE_ALPHA, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
+	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
+	//fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
 	// the normals buffer
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
+	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
 	// another color buffer
-	fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
+	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, ColorBufferObject::FILTER_NEAREST);
 
 	PrintGLerror("fbo");
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3000)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3001)
@@ -272,8 +272,8 @@
 	mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);
 
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
-	mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
+	mFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2999)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 3001)
@@ -15,5 +15,5 @@
 public:
 
-	enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32, BUFFER_LUMINANCE_ALPHA };
+	enum FORMAT { RGBA_UBYTE, RGBA_FLOAT_16, RGB_FLOAT_32, RGBA_FLOAT_32};
 	enum WRAP_TYPE { WRAP_REPEAT, WRAP_CLAMP_TO_EDGE };
 	enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR };
