Index: GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.cpp	(revision 2765)
@@ -3,4 +3,5 @@
 #include "Timers.h"
 #include "Camera.h"
+#include "SceneEntity.h"
 
 
@@ -29,10 +30,10 @@
 
 
-RenderTraverser::RenderTraverser(): 
-mFrameID(1), 
+RenderTraverser::RenderTraverser():  
 mVisibilityThreshold(0),
 mBvh(NULL), 
 mIsQueryMode(false),
-mUseOptimization(true)
+mUseOptimization(true),
+mFrameId(-1)
 {
 }
@@ -42,4 +43,16 @@
 {
 	mQueryHandler.DestroyQueries();
+}
+
+
+void RenderTraverser::InitFrame(Camera *camera, int currentFrameId)
+{
+	mFrameId = currentFrameId;
+	mBvh->InitFrame(camera, currentFrameId);
+
+	mStats.Reset();
+	mQueryHandler.ResetQueries();
+	mRenderState->mTexturesEnabled = false;
+	EnqueueNode(mBvh->GetRoot());
 }
 
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/StopAndWaitTraverser.cpp	(revision 2765)
@@ -23,10 +23,4 @@
 void StopAndWaitTraverser::Render()
 {
-	mStats.Reset();
-	mRenderState->mTexturesEnabled = false;
-	EnqueueNode(mBvh->GetRoot());
-
-	//cout<<"\n***** starting frame **********\n";
-	int traversed = 0;
 	while (!mDistanceQueue.empty())
 	{
@@ -34,7 +28,5 @@
 		mDistanceQueue.pop();
 	
-		//float d = mBvh->GetDistance(node);cout << d << " ";
-
-		// interesting for the visualization, so rest and set
+		// interesting for the visualization
 		node->SetVisible(false);
 
@@ -72,10 +64,6 @@
 		{
 			++ mStats.mNumFrustumCulledNodes;
-		}
-		//cout << "intersect: " << intersect << " bx " << node->GetBox() << endl;
+		}	
 	}
-
-	mQueryHandler.ResetQueries();
-	//std::cout << "traversed: " << traversed << std::endl;
 }
 
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.cpp	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/CHCTraverser.cpp	(revision 2765)
@@ -19,8 +19,4 @@
 void CHCTraverser::Render()
 {
-	mStats.Reset();
-	mRenderState->mTexturesEnabled = false;
-	EnqueueNode(mBvh->GetRoot());
-
 	QueryQueue queryQueue;
 
@@ -63,5 +59,5 @@
 				{
 					// update node's visited flag
-					node->SetLastVisitedFrame(mFrameID);
+					node->SetLastVisitedFrame(mFrameId);
 					node->SetVisible(true);
 					mBvh->MakeParentsVisible(node);
@@ -72,9 +68,9 @@
 				{		
 					// identify previously visible nodes
-					const bool wasVisible = node->IsVisible() && (node->GetLastVisitedFrame() == mFrameID - 1);
+					const bool wasVisible = node->IsVisible() && (node->GetLastVisitedFrame() == mFrameId - 1);
 					
 					// identify nodes that we cannot skip queries for
 					const bool leafOrWasInvisible = 
-						(node->GetLastVisitedFrame() != mFrameID) && (!wasVisible || node->IsVirtualLeaf());
+						(node->GetLastVisitedFrame() != mFrameId) && (!wasVisible || node->IsVirtualLeaf());
 
 					// reset node's visibility classification 
@@ -82,5 +78,5 @@
 
 					// update node's visited flag
-					node->SetLastVisitedFrame(mFrameID);
+					node->SetLastVisitedFrame(mFrameId);
 					
 					// skip testing previously visible interior nodes
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2765)
@@ -308,9 +308,8 @@
 	GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0};
 	GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0};
-	//GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
 	GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
 	    
-	//GLfloat lmodel_ambient[] = {0.5f, 0.5f, 0.5f, 1.0};
-	GLfloat lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};
+	GLfloat lmodel_ambient[] = {0.5f, 0.5f, 0.5f, 1.0f};
+	//GLfloat lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};
 
 	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
@@ -373,5 +372,6 @@
 	SetupEyeView();
 
-	bvh->InitFrame(camera, currentFrame);
+
+	traverser->InitFrame(camera, currentFrame);
 
 
@@ -380,8 +380,4 @@
 
 	t1 = GetTime();
-
-	traverser->SetCamera(camera);
-
-	//traverser->RenderFrustum();
 
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -860,5 +856,5 @@
 	CalcDecimalPoint(str2, traverser->GetStats().mNumRenderedTriangles);
 
-	sprintf_s(msg4, "rendered objects %d (of %d), rendered triangles: %s (of %s)", 
+	sprintf_s(msg4, "rendered objects %5d (of %5d), rendered triangles: %s (of %s)", 
 			  traverser->GetStats().mNumRenderedGeometry, sceneEntities.size(), str.c_str(), str2.c_str()); 
 
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/FrustumCullingTraverser.cpp	(revision 2765)
@@ -15,8 +15,4 @@
 void FrustumCullingTraverser::Render()
 {
-	mStats.Reset();
-	mRenderState->mTexturesEnabled = false;
-	EnqueueNode(mBvh->GetRoot());
-
 	while (!mDistanceQueue.empty())
 	{
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h	(revision 2764)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/RenderTraverser.h	(revision 2765)
@@ -84,4 +84,6 @@
 	const TraversalStatistics &GetStats() const { return mStats; }
 
+	void InitFrame(Camera *camera, int currentFrameId);
+
 protected:
 
@@ -129,5 +131,5 @@
 	TraversalQueue mDistanceQueue; 
 	
-	int mFrameID;
+	int mFrameId;
 	int mVisibilityThreshold;
 
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h	(revision 2763)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/OcclusionQuery.h	(revision 2765)
@@ -65,4 +65,5 @@
 
 	QueryHandler();
+	~QueryHandler() { DestroyQueries(); }
 
 	OcclusionQuery *RequestQuery();
@@ -71,4 +72,6 @@
 	*/
 	void ResetQueries();
+	/** Destroys all the queries.
+	*/
 	void DestroyQueries();
 
