Index: trunk/VUT/GtpVisibility/include/HierarchyInterface.h
===================================================================
--- trunk/VUT/GtpVisibility/include/HierarchyInterface.h	(revision 174)
+++ trunk/VUT/GtpVisibility/include/HierarchyInterface.h	(revision 175)
@@ -47,5 +47,5 @@
 		@returns occlusion query for this node
 	*/
-	virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node, 
+	virtual OcclusionQuery *IssueNodeOcclusionQuery(HierarchyNode *node, 
 		const bool wasVisible = false) = 0;
 	/** Sets the root of the scene hierarchy.
@@ -124,5 +124,5 @@
 		CullingType type) = NULL;
 
-	/** Returns vector of previously rendered hierarchy nodes.
+	/** Returns vector of visible hierarchy nodes from previous render.
 	*/
 	std::vector<HierarchyNode *> *GetVisibleNodes();
@@ -130,10 +130,4 @@
 	*/
 	
-	/** Issue a occlusion query for this mesh.
-		@param node the current mesh
-		@returns occlusion query for this node
-	*/
-	virtual GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Mesh *mesh) = 0;
-
 	/** Returns the geometry of a given hierarchy node. 
 		@param node the hierarchy node containing the geometry
@@ -144,9 +138,4 @@
 					 		 GeometryList *geometryList, 
 							 bool includeChildren) = 0;
-
-
-	/** Renders the given geometry.
-	*/
-	virtual void RenderGeometry(GtpVisibility::Mesh *geom) = 0;
 
 	
@@ -159,5 +148,4 @@
 	*/
 	void TestGeometryForVisibleLeaves(bool testGeometry);
-
 
 
Index: trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h
===================================================================
--- trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h	(revision 74)
+++ trunk/VUT/GtpVisibility/include/VisibilityEnvironment.h	(revision 175)
@@ -13,7 +13,8 @@
 	/** Different types of occlusion culling algorithms 
 	*/
-	enum CullingManagerType {FRUSTUM_CULLING, 
+	enum CullingManagerType {
+							 COHERENT_HIERARCHICAL_CULLING, 
+							 FRUSTUM_CULLING, 
 							 STOP_AND_WAIT_CULLING, 
-							 COHERENT_HIERARCHICAL_CULLING, 
 							 NUM_CULLING_MANAGERS};
 
Index: trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp	(revision 158)
+++ trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp	(revision 175)
@@ -7,4 +7,5 @@
 void FrustumCullingManager::RenderScene()
 {
+	//Ogre::LogManager::getSingleton().logMessage("Frustum Culling");
 	while (!mHierarchyInterface->GetQueue()->empty())
 	{
Index: trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 158)
+++ trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp	(revision 175)
@@ -25,5 +25,6 @@
 	unsigned int visiblePixels = 0;
 	bool isAvailable = false;
-	
+	//Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling");
+
 	//-- PART 1: process finished occlusion queries
 	while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty())
@@ -105,5 +106,5 @@
 					
 					queryQueue.push(QueryPair(node, mHierarchyInterface->
-						IssueOcclusionQuery(node, wasVisible)));
+						IssueNodeOcclusionQuery(node, wasVisible)));
 				}
 				
Index: trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
===================================================================
--- trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 158)
+++ trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp	(revision 175)
@@ -7,4 +7,5 @@
 void StopAndWaitCullingManager::RenderScene()
 {
+	//Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling");
 	while (!mHierarchyInterface->GetQueue()->empty())
 	{
@@ -40,5 +41,5 @@
 			unsigned int visiblePixels = 0;
 
-			mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult(visiblePixels, true);
+			mHierarchyInterface->IssueNodeOcclusionQuery(node)->GetQueryResult(visiblePixels, true);
 			
 			// node visible
Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 174)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 175)
@@ -16,7 +16,7 @@
 String TerrainFrameListener::msAlgorithmCaptions[] = 
 {
+	"Coherent Hierarchical Culling",
 	"View Frustum Culling", 
-	"Stop and Wait Culling", 
-	"Coherent Hierarchical Culling"
+	"Stop and Wait Culling"
 };
 
@@ -42,5 +42,6 @@
 {
 	0,
-	7,
+	0,
+	//7,
 	0
 };
@@ -49,6 +50,7 @@
 {
 	0.1,
-	0.6,
-	0.07
+	0.03,
+	//0.1,
+	0.04
 };
 
@@ -56,5 +58,6 @@
 {
 	"robot",
-	"athene",
+	//"athene",
+	"natFX_Tree1_LOD2",
 	//"tree2",
 	//"HongKong_Tower",
@@ -111,5 +114,5 @@
 mShowOctree(false),
 mUseDepthPass(false),
-mTestGeometryForVisibleLeaves(true),
+mTestGeometryForVisibleLeaves(false),
 mShowVisualization(false),
 mCullCamera(false),
@@ -426,10 +429,11 @@
 	int itemBufferMode = useItemBuffer ? mItemBufferMode : 0;
 	
-	int queryModes = GtpVisibility::QueryManager::PATCH_VISIBILITY; 
+	int queryModes = 0;
+	queryModes |= GtpVisibility::QueryManager::PATCH_VISIBILITY; 
 	queryModes |= GtpVisibility::QueryManager::GEOMETRY_VISIBILITY;
 	queryModes |= GtpVisibility::QueryManager::NODE_VISIBILITY;
-
+	
 	mQueryManager = new OcclusionQueriesQueryManager(sm->GetHierarchyInterface(),
-			mWindow->getViewport(0), queryModes, useItemBuffer);
+			mWindow->getViewport(0), queryModes, itemBufferMode);
 
 	//mQueryManager = new PlatformQueryManager(sm->GetHierarchyInterface(),	mWindow->getViewport(0), false);
@@ -455,5 +459,6 @@
 		
 	std::stringstream d; 
-	d << msQueryTypeCaptions[fromPoint ?  1 : 0].c_str() << " "
+	d << "Query mode: " << queryModes << ", "
+	  << msQueryTypeCaptions[fromPoint ?  1 : 0].c_str() << " "
 	  << msQueryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " "
       << msQueryMethodCaptions[useItemBuffer ? 1 : 0].c_str();
@@ -744,6 +749,5 @@
 {
 	mCurrentAlgorithm = (mCurrentAlgorithm + 1) % 
-		GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS,
-
+		(GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS - 1);
 	setAlgorithm(mCurrentAlgorithm);
 }
Index: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 173)
+++ trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp	(revision 175)
@@ -228,5 +228,5 @@
 {
 	// Set ambient light
-	mAmbientLight = ColourValue(0.5, 0.5, 0.5);
+	mAmbientLight = ColourValue(0.5 , 0.5, 0.5);
 	mSceneMgr->setAmbientLight(mAmbientLight);
 	
@@ -256,5 +256,5 @@
 	
 	// Create a skybox
-	mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox", 5000, false);
+	mSceneMgr->setSkyBox(true, "Examples/CloudyNoonSkyBox", 5000, true);
 	
 	std::string terrain_cfg("terrain.cfg");
@@ -301,12 +301,40 @@
 	if (!mTerrainContentGenerator->LoadObjects("objects.out"))
 	{
-		// to provide much occlusion,
-		// height is restricted to 50 => no objects are created on peaks
-		mTerrainContentGenerator->SetMinPos(Vector3(mTerrainMinPos));
-		mTerrainContentGenerator->SetMaxPos(Vector3(mTerrainMaxPos.x, 50.0f, mTerrainMaxPos.z));
-		mTerrainContentGenerator->SetOffset(0);
-
 		// the objects are generated randomly distributed over the terrain
-		generateScene(1500, 0);
+		generateScene(900, 0);
+		generateScene(500, 1);
+		generateScene(100, 2);
+	}
+
+	// no limitations on height => it is possible for the user to put single 
+	// objects on peaks of the terrain (only few, not relevant for occlusion)
+	mTerrainContentGenerator->SetMaxPos(mTerrainMaxPos);
+}
+//-----------------------------------------------------------------------
+void  TestCullingTerrainApplication::generateScene(int num, int objectType)
+{
+	Vector3 scale(TerrainFrameListener::msObjectScales[objectType], 
+				  TerrainFrameListener::msObjectScales[objectType],
+				  TerrainFrameListener::msObjectScales[objectType]);
+
+	// to provide much occlusion,
+	// height is restricted to 50 => no objects are created on peaks
+	mTerrainContentGenerator->SetMinPos(Vector3(mTerrainMinPos));
+	mTerrainContentGenerator->SetMaxPos(Vector3(mTerrainMaxPos.x, 75.0f, mTerrainMaxPos.z));
+	
+	mTerrainContentGenerator->SetScale(scale);
+	mTerrainContentGenerator->SetOffset(TerrainFrameListener::msObjectTerrainOffsets[objectType]);
+	mTerrainContentGenerator->GenerateScene(num, TerrainFrameListener::msObjectCaptions[objectType]);
+
+	if (objectType != 0) // from our objects, only robot has animation phases
+		return;
+
+	EntityList *entList = mTerrainContentGenerator->GetGeneratedEntities();
+
+	//-- add animation state for new robots (located at the end of the list)
+	for (int i = (int)entList->size() - num; i < (int)entList->size(); ++i)
+	{
+		mEntityStates.push_back(new EntityState((*entList)[i], 
+			EntityState::WAITING, Math::RangeRandom(0.5, 1.5)));
 	}
 
@@ -314,27 +342,4 @@
 	// objects on peaks of the terrain (only few, not relevant for occlusion)
 	mTerrainContentGenerator->SetMaxPos(mTerrainMaxPos);
-}
-//-----------------------------------------------------------------------
-void  TestCullingTerrainApplication::generateScene(int num, int objectType)
-{
-	Vector3 scale(TerrainFrameListener::msObjectScales[objectType], 
-				  TerrainFrameListener::msObjectScales[objectType],
-				  TerrainFrameListener::msObjectScales[objectType]);
-
-	mTerrainContentGenerator->SetScale(scale);
-	mTerrainContentGenerator->SetOffset(TerrainFrameListener::msObjectTerrainOffsets[objectType]);
-	mTerrainContentGenerator->GenerateScene(num, TerrainFrameListener::msObjectCaptions[objectType]);
-
-	if (objectType != 0) // from our objects, only robot has animation phases
-		return;
-
-	EntityList *entList = mTerrainContentGenerator->GetGeneratedEntities();
-
-	//-- add animation state for new robots (located at the end of the list)
-	for (int i = entList->size() - num; i < (int)entList->size(); ++i)
-	{
-		mEntityStates.push_back(new EntityState((*entList)[i], 
-			EntityState::WAITING, Math::RangeRandom(0.5, 1.5)));
-	}
 }
 //-----------------------------------------------------------------------
Index: trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h
===================================================================
--- trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h	(revision 174)
+++ trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h	(revision 175)
@@ -75,12 +75,12 @@
 		@returns occlusion query for this node
 	*/
-	GtpVisibility::OcclusionQuery *IssueOcclusionQuery(
+	GtpVisibility::OcclusionQuery *IssueNodeOcclusionQuery(
 		GtpVisibility::HierarchyNode *node, const bool wasVisible);
 
 	/** Issue a occlusion query for this mesh.
-		@param node the current mesh
-		@returns occlusion query for this node
+		@param mesh the mesh for which an occlusion query is issued.
+		@returns occlusion query for this mesh.
 	*/
-	GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Mesh *mesh);
+	GtpVisibility::OcclusionQuery *IssueMeshOcclusionQuery(GtpVisibility::Mesh *mesh);
 
 	/** If true, the interface finds and renders only objects which are marked as shadow casters.
@@ -106,12 +106,12 @@
     bool IsBoundingBoxQuery();
 
-	GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Patch *patch);
+	GtpVisibility::OcclusionQuery *IssuePatchOcclusionQuery(GtpVisibility::Patch *patch);
 
 protected:
-	/** Renders geometry 
+	/** Renders the given geometry 
 	*/
 	void RenderGeometry(GtpVisibility::Mesh *geom);
-
-	/** Renders a patch 
+	
+	/** Renders the given patch 
 	*/
 	void RenderPatch(GtpVisibility::Patch *patch);
Index: trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 174)
+++ trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp	(revision 175)
@@ -240,4 +240,7 @@
 void VisibilityTerrainSceneManager::_renderVisibleObjects()
 {
+	InitDepthPass(); 	  // create material for depth pass
+	InitItemBufferPass(); // create material for item buffer pass
+
 	// save ambient light to reset later
 	ColourValue savedAmbient = mAmbientLight;
@@ -629,7 +632,4 @@
 void VisibilityTerrainSceneManager::InitVisibilityCulling(Camera *cam)
 {
-	InitDepthPass(); 	  // create material for depth pass
-	InitItemBufferPass(); // create material for item buffer pass
-
 	// reset culling manager stats
 	mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
Index: trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 160)
+++ trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp	(revision 175)
@@ -29,10 +29,4 @@
 void SceneContentGenerator::GenerateScene(int numObjects, const String &objName)
 {
-	// initialise random generator
-	srand (time(0));
-	
-	Vector3 rotationRatio;
-	Vector3 translationRatio;
-
 	int new_size = GetObjectCount() + numObjects;
 	int failed_attempts = 0; // counter used to avoid invinite loop
@@ -42,19 +36,16 @@
 		   (failed_attempts < MAX_FAILED_ATTEMPTS))
 	{
-		rotationRatio.x = rand() / (float) RAND_MAX;
-		rotationRatio.y = rand() / (float) RAND_MAX;
-		rotationRatio.z = rand() / (float) RAND_MAX;
-
-		translationRatio.x = rand() / (float) RAND_MAX;
-		translationRatio.y = rand() / (float) RAND_MAX;
-		translationRatio.z = rand() / (float) RAND_MAX;
-
 		// Setup the ray scene query
-		Vector3 rotation = mMinAngle + rotationRatio * (mMaxAngle - mMinAngle);
-		Vector3 position = mMinPos + translationRatio * (mMaxPos - mMinPos);
+		Vector3 rotation = Vector3(Math::RangeRandom(mMinAngle.x, mMaxAngle.x),
+								   Math::RangeRandom(mMinAngle.y, mMaxAngle.y),
+								   Math::RangeRandom(mMinAngle.z, mMaxAngle.z));
+
+		Vector3 position = Vector3(Math::RangeRandom(mMinPos.x, mMaxPos.x),
+								   Math::RangeRandom(mMinPos.y, mMaxPos.y),
+								   Math::RangeRandom(mMinPos.z, mMaxPos.z));
 
 		// failed to generate new object
 		if (!GenerateSceneObject(position, rotation, objName))
-			++failed_attempts; 
+			++ failed_attempts; 
 	}
 }
@@ -68,5 +59,6 @@
 		
 	Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh");
-		
+	ent->setCastShadows(true);
+
 	SceneNode *node = mSceneMgr->getRootSceneNode()->
 		createChildSceneNode(String(name) + "Node", position);
@@ -80,5 +72,5 @@
 	mSceneNodes.push_back(node);
 	mEntities.push_back(ent);
-
+	
 	return node;
 }
Index: trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 174)
+++ trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp	(revision 175)
@@ -237,4 +237,7 @@
 void VisibilityOctreeSceneManager::_renderVisibleObjects()
 {
+	InitDepthPass(); 	  // create material for depth pass
+	InitItemBufferPass(); // create material for item buffer pass
+
 	// save ambient light to reset later
 	ColourValue savedAmbient = mAmbientLight;
@@ -629,7 +632,4 @@
 void VisibilityOctreeSceneManager::InitVisibilityCulling(Camera *cam)
 {
-	InitDepthPass(); 	  // create material for depth pass
-	InitItemBufferPass(); // create material for item buffer pass
-
 	// reset culling manager stats
 	mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes);
Index: trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 174)
+++ trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp	(revision 175)
@@ -165,5 +165,5 @@
 }
 //-----------------------------------------------------------------------
-GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(
+GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueNodeOcclusionQuery(
 	GtpVisibility::HierarchyNode *node, const bool wasVisible) 
 {
@@ -200,5 +200,5 @@
 }
 //-----------------------------------------------------------------------
-GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(
+GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssuePatchOcclusionQuery(
 	GtpVisibility::Patch *patch)
 {
@@ -216,5 +216,5 @@
 }
 //-----------------------------------------------------------------------
-GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery(
+GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueMeshOcclusionQuery(
 	GtpVisibility::Mesh *mesh)
 {
@@ -287,7 +287,5 @@
 void PlatformHierarchyInterface::RenderPatch(GtpVisibility::Patch *patch)
 {
-	Pass *pass = patch->getTechnique()->getPass(0);
-	mSceneManager->setPass(pass);
-	mSceneManager->renderSingleObject(patch, pass, false);
+	mSceneManager->_renderSingleRenderable(patch);
 }
 //-----------------------------------------------------------------------
Index: trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp
===================================================================
--- trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp	(revision 174)
+++ trunk/VUT/Ogre/src/OgreOcclusionQueriesQueryManager.cpp	(revision 175)
@@ -68,4 +68,5 @@
 
 	//-- render scene with item buffer (i.e., objects with their id as color codes)
+//mItemBufferMode = 0;
 	if ((mItemBufferMode && mQueryModes) != 0)
 	{
@@ -104,5 +105,5 @@
     GtpVisibility::HierarchyNodeList nodeList;
 
-	if (mQueryModes && NODE_VISIBILITY)
+	if (mQueryModes & NODE_VISIBILITY)
 	{
 		for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt)
@@ -118,5 +119,5 @@
 	
 	// store geometry of the hierarchy nodes in a geometry list
-	if (mQueryModes && GEOMETRY_VISIBILITY)
+	if (mQueryModes & GEOMETRY_VISIBILITY)
 	{	
 		for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt)	
@@ -133,5 +134,5 @@
 
 	// store patchges of the geometries in a patch list
-	if (mQueryModes && PATCH_VISIBILITY)
+	if (mQueryModes & PATCH_VISIBILITY)
 	{
 		for (visNodesIt = visNodes->begin(); visNodesIt != visNodesIt_end; ++visNodesIt)	
@@ -159,5 +160,7 @@
 	// for relative visibility we need 2 rendering passes
 	int n = relativeVisibility ? 2 : 1;
-	
+	if (mItemBufferMode > 0)
+		LogManager::getSingleton().logMessage("item buffer");
+
 	for (int i = 0; i < n; ++i)
 	{
@@ -166,13 +169,13 @@
 		{
 			// TODO: DELETE QUERIES FROM PREVIOUS RENDER
-			queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*nodeIt, false));
+			queryList[i].push_back(mHierarchyInterface->IssueNodeOcclusionQuery(*nodeIt, false));
 		}
 
 		//-- queries for geometry: if item buffer, capture only projected visibility
 		if ((mItemBufferMode != GEOMETRY_VISIBILITY) || (i == 1))
-		{
+		{			
 			for (geometryIt = geometryList.begin(); geometryIt != geometryIt_end; ++geometryIt)
 			{
-				queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*geometryIt));
+				queryList[i].push_back(pfHierarchyInterface->IssueMeshOcclusionQuery(*geometryIt));
 			}
 		}
@@ -183,5 +186,5 @@
 			for (patchIt = patchList.begin(); patchIt != patchIt_end; ++patchIt)
 			{
-				queryList[i].push_back(mHierarchyInterface->IssueOcclusionQuery(*patchIt));
+				queryList[i].push_back(pfHierarchyInterface->IssuePatchOcclusionQuery(*patchIt));
 			}
 		}
@@ -199,5 +202,4 @@
 
 
-
 	// collect occlusion queries for geometry
 	if ((mItemBufferMode == GEOMETRY_VISIBILITY) && relativeVisibility)
@@ -207,5 +209,5 @@
 		CollectRelativeGeometryVisibilityForItemBuffer(projQueryIt, &geometryList, visibleGeometry);
 	}
-	else
+	else if (mItemBufferMode != GEOMETRY_VISIBILITY)
 	{
 		CollectGeometryVisibility(visQueryIt, projQueryIt, &geometryList, visibleGeometry, 
@@ -219,5 +221,5 @@
 		CollectRelativePatchVisibilityForItemBuffer(projQueryIt, &patchList, visiblePatches);
 	}
-	else
+	else if (mItemBufferMode != PATCH_VISIBILITY)
 	{
 		CollectPatchVisibility(visQueryIt, projQueryIt, &patchList, visiblePatches, relativeVisibility);
@@ -244,6 +246,6 @@
 		visibleGeometry, visiblePatches, relativeVisibility);
 
-	// remove duplicates (duplicates occur if an object is on the edge of the viewport)
-	// before duplicates can be deleted we have to add up their visibility
+	// adds up their visibility and removes duplicates 
+	// (duplicates occur if an object is on the edge of the viewport)
 	RemoveDuplicateNodes(visibleNodes);
 	
@@ -258,5 +260,5 @@
 	}
 }
-//-----------------------------------------------------------------------
+//------j-----------------------------------------------------------------
 void  OcclusionQueriesQueryManager::CollectNodeVisibility(
 						GtpVisibility::QueryList::iterator &visQueryIt, 
