Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp	(revision 2862)
@@ -77,6 +77,6 @@
 	glGenTextures(1, &mTexId);
 	glBindTexture(GL_TEXTURE_2D, mTexId);
-	//glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, GL_RGBA, glformat, NULL);
 	glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, GL_RGBA, glformat, NULL);
+
 	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, color_attachment[attachment_idx], GL_TEXTURE_2D, mTexId, 0);
 
@@ -118,9 +118,10 @@
 
 
-FrameBufferObject::FrameBufferObject(int w, int h, DEPTH_FORMAT d)
-: mWidth(w), mHeight(h)
+FrameBufferObject::FrameBufferObject(int w, int h, DEPTH_FORMAT d, bool useDepthTex)
+: mWidth(w), mHeight(h), mDepthTexId(0)
 {
 	glGenFramebuffersEXT(1, &mId);
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);
+	
+	Bind();
 
 	cout << "creating fbo" << endl;
@@ -152,5 +153,26 @@
 		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormat, mWidth, mHeight);
 		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepthId);
-	}
+
+		if (useDepthTex)
+		{
+			//cout << "adding depth texture" << endl;
+
+			glGenTextures(1, &mDepthTexId);
+			glBindTexture(GL_TEXTURE_2D, mDepthTexId);
+
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+			
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+			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);
+
+			glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, mDepthTexId, 0);
+		}
+	}
+
+	Release();
 }
 
@@ -164,5 +186,5 @@
 	cout << "adding color buffer" << endl;
 
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);
+	Bind();
 
 	int idx = (int)mColorBuffers.size();
@@ -172,19 +194,19 @@
 	mColorBuffers.push_back(colorBuf);
 
+	Release();
+
+	return idx;
+}
+
+
+void FrameBufferObject::Bind() const
+{
+	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);
+}
+
+
+void FrameBufferObject::Release()
+{
 	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-
-	return idx;
-}
-
-
-void FrameBufferObject::Bind() const
-{
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);
-}
-
-
-void FrameBufferObject::Release()
-{
-	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 }
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2862)
@@ -69,5 +69,5 @@
 		str.read(reinterpret_cast<char *>(&dist), sizeof(float));
 
-		if (i>=3) dist=2e20;
+		//if (i>=3) dist=2e20;
 		int numShapes;
 		str.read(reinterpret_cast<char *>(&numShapes), sizeof(int));
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2849)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2862)
@@ -139,7 +139,7 @@
 
 #ifdef ATI
-	depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE);
+	depthTexture->Initialize(true, true, false, false, false, 32, 32, 32, 32, RenderTexture::RT_COPY_TO_TEXTURE);
 #else
-	depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE);
+	depthTexture->Initialize(true, true, false, false, false, 32, 32, 32, 32);
 #endif
 
@@ -185,6 +185,5 @@
 
 	GrabDepthBuffer(mDepth, depthTexture);
-	ExportDepthBuffer(mDepth);
-	PrintGLerror("grab");
+	//ExportDepthBuffer(mDepth); PrintGLerror("grab");
 
 	DEL_PTR(depthTexture);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2861)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h	(revision 2862)
@@ -47,5 +47,5 @@
 	/** constructor requesting an opengl occlusion query.
 	*/
-	FrameBufferObject(int w, int h, DEPTH_FORMAT d);
+	FrameBufferObject(int w, int h, DEPTH_FORMAT d, bool useDepthTex = false);
 	/** Creates and adds a color buffer to the current frame buffer object.
 		Returns the index that allows to retrieve the color buffer object.
@@ -66,4 +66,5 @@
 	*/
 	static void Release();
+	
 
 protected:
@@ -76,4 +77,6 @@
 	int mHeight;
 	int mWidth;
+
+	unsigned int mDepthTexId;
 };
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt	(revision 2847)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt	(revision 2862)
@@ -81,5 +81,11 @@
 The project is separated into one section containing supportive code (utils), the traversal algorithms (traversal), and the basic engine classes like Camera, Geometry, Material, or RenderState (rendering). 
 
-the tool uses some free 3rd party libraries, like DevIL for the image processing, and glfont2 for the HUD (http://students.cs.byu.edu/~bfish/glfont2.php, many thanks to Brad Fish for fast antialiased text). Also thanks to Alexander Kusternig for providing me his code for the SSAO shader.
+The tool employs some free 3rd party libraries: 
+
+DevIL for texture loading / unloading
+glfont2 (http://students.cs.byu.edu/~bfish/glfont2.php) for the antialiased fonts of the HUD. Thanks to the author Brad Fish. 
+The RenderTexture library. Thanks to the author Mark J. Harris.
+
+Thanks also to Alexander Kusternig for providing me his code for the SSAO shader.
 
 If you find any problem with the code or have any comments, please feel free to ask us at any time.
