Index: /GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp	(revision 2773)
+++ /GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp	(revision 2774)
@@ -167,6 +167,4 @@
 
 
-
-
 void RenderTraverser::SetVisibilityThreshold(int threshold)
 {
@@ -181,6 +179,5 @@
 
 
-
-
+#if 0
 OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible)
 {
@@ -193,6 +190,8 @@
 }
 
-
-void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible)
+#else
+
+
+OcclusionQuery *RenderTraverser::IssueOcclusionQuery(BvhNode *node, bool wasVisible)
 {
 	++ mStats.mNumIssuedQueries;
@@ -204,5 +203,10 @@
 	}
 
-	query.BeginQuery();
+	OcclusionQuery *query = mQueryHandler.RequestQuery();
+
+	query->Reset();
+	query->AddNode(node);
+
+	query->BeginQuery();
 
 	if (wasVisible)
@@ -213,6 +217,5 @@
 	if (wasVisible && mUseOptimization)
 	{
-		for (size_t i = 0; i < query.GetNodes().size(); ++ i)
-			RenderNode(query.GetNodes()[i]);
+		RenderNode(node);
 	}
 	else
@@ -222,4 +225,41 @@
 			++ mStats.mNumStateChanges;
 
+		mBvh->RenderBoundingBox(node, mRenderState);
+	}
+
+	query->EndQuery();
+
+	return query;
+}
+
+#endif
+void RenderTraverser::IssueOcclusionQuery(const OcclusionQuery &query, bool wasVisible)
+{
+	++ mStats.mNumIssuedQueries;
+
+	if (mUseRenderQueue && (mRenderState->GetMode() == RenderState::RENDER))
+	{
+		mRenderQueue.Render();
+		mRenderQueue.Clear();
+	}
+
+	query.BeginQuery();
+
+	if (wasVisible)
+		++ mStats.mNumPreviouslyVisibleNodeQueries;
+
+	// if this node is a previous visible leaf:
+	// leaves will be rendered anyway => we can also test with the real geometry 
+	if (wasVisible && mUseOptimization)
+	{
+		for (size_t i = 0; i < query.GetSize(); ++ i)
+			RenderNode(query.GetNodes()[i]);
+	}
+	else
+	{
+		// change to query mode and render box
+		if (mRenderState->SetState(RenderState::QUERY))
+			++ mStats.mNumStateChanges;
+
 		mBvh->RenderBoundingBoxes(query.GetNodes(), mRenderState);
 	}
Index: /GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp	(revision 2773)
+++ /GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp	(revision 2774)
@@ -765,6 +765,8 @@
 
 	for (int i = node->mFirst; i <= node->mLast; ++ i)
+	{
 		numTriangles += mGeometry[i]->GetGeometry()->GetNumTriangles();
-	
+	}
+
 	return numTriangles;
 }
Index: /GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2773)
+++ /GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2774)
@@ -897,5 +897,4 @@
 
 	sprintf_s(msg5, "fps: %6.1f", fps);
-
 	//cout << "previously visible node queries: " << traverser->GetStats().mNumPreviouslyVisibleNodeQueries << endl;
 
@@ -909,5 +908,4 @@
 	{
 		glColor3f(1.0f, 1.0f, 1.0f);
-		
 		Output(850, 30, msg[renderMode]);
 
Index: /GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.cpp	(revision 2773)
+++ /GTP/trunk/App/Demos/Vis/CHC_revisited/CHCPlusPlusTraverser.cpp	(revision 2774)
@@ -97,5 +97,6 @@
 					
 					// identify nodes that we cannot skip queries for
-					const bool testFeasible = (!wasVisible || (node->IsVirtualLeaf() && (node->GetAssumedVisibleFrameId() <= mFrameId)));
+					const bool testFeasible = (!wasVisible || (node->IsVirtualLeaf() && 
+						(node->GetAssumedVisibleFrameId() <= mFrameId)));
 
 					// node was not recently tested => reset flag 
@@ -200,5 +201,7 @@
 
 		if (query->GetNodes().empty())
+		{
 			newBatchVal = 1.0f;
+		}
 		else
 		{
@@ -237,4 +240,5 @@
 		BvhNode *node = mIQueue.front();
 		mIQueue.pop();
+
 		OcclusionQuery *query = GetNextMultiQuery(mIQueue);
 		//OcclusionQuery *query = IssueOcclusionQuery(node);
