Index: trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp	(revision 61)
+++ trunk/VUT/work/ogre_changes/OgreMain/src/OgreSceneManager.cpp	(revision 99)
@@ -4178,5 +4178,5 @@
     }
 }
-#ifdef OGRE_COHERENT_OCCLUSION_CULLING
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 //-----------------------------------------------------------------------
 void SceneManager::_renderSceneNode( Camera *cam, SceneNode *node )
@@ -4193,4 +4193,5 @@
 	RenderQueue::QueueGroupIterator queueIt = getRenderQueue()->_getQueueGroupIterator();
 
+	// find currently processed queue groups and delelete them from render queue
 	while (queueIt.hasMoreElements())
 	{
@@ -4198,5 +4199,4 @@
 		RenderQueueGroup* pGroup = queueIt.getNext();
 
-		// delete this queue group if already processed
 		if (isRenderQueueToBeProcessed(qId))
 			pGroup->clear();
@@ -4206,4 +4206,4 @@
 	// Pass::processPendingPassUpdates();
 }
-#endif //OGRE_COHERENT_OCCLUSION_CULLING
-}
+#endif //GTP_VISIBILITY_MODIFIED_OGRE
+}
Index: trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp	(revision 61)
+++ trunk/VUT/work/ogre_changes/Plugins/OctreeSceneManager/src/OgreOctreeSceneManager.cpp	(revision 99)
@@ -316,7 +316,7 @@
 
     mOctree = new Octree( 0 );
-#ifdef OGRE_COHERENT_OCCLUSION_CULLING
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	mNumOctreeNodes = 1;
-#endif // OGRE_COHERENT_OCCLUSION_CULLING
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
     mMaxDepth = depth;
     mBox = box;
@@ -461,7 +461,7 @@
         {
             octant -> mChildren[ x ][ y ][ z ] = new Octree( octant );
-#ifdef OGRE_COHERENT_OCCLUSION_CULLING
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	mNumOctreeNodes ++;
-#endif // OGRE_COHERENT_OCCLUSION_CULLING
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
 
             const Vector3 *corners = octant -> mBox.getAllCorners();
@@ -1028,7 +1028,7 @@
 
     mOctree = new Octree( 0 );
-#ifdef OGRE_COHERENT_OCCLUSION_CULLING
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 	mNumOctreeNodes = 1;
-#endif // OGRE_COHERENT_OCCLUSION_CULLING
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
     mOctree->mBox = box;
 
@@ -1166,5 +1166,5 @@
     return q;
 }
-#ifdef OGRE_COHERENT_OCCLUSION_CULLING
+#ifdef GTP_VISIBILITY_MODIFIED_OGRE
 //-----------------------------------------------------------------------
 void OctreeSceneManager::_renderOctant(Camera *cam, Octree *octant)
@@ -1177,5 +1177,5 @@
 		OctreeNode *sn = *it;
 
-        mNumObjects++;
+        ++mNumObjects;
 
 		// check bounding box visibility of scene nodes
@@ -1187,21 +1187,28 @@
 
 			if (mDisplayNodes)
+			{
 				getRenderQueue()->addRenderable(sn);
+			}
 
 			// check if the scene manager or this node wants the bounding box shown.
 			if (sn->getShowBoundingBox() || mShowBoundingBoxes)
+			{
 				sn->_addBoundingBoxToQueue(getRenderQueue());
-
-			if (mShowBoxes)
-				getRenderQueue()->addRenderable(octant->getWireBoundingBox());
+			}
 		}
         ++it;
 	}
 
+	if (mShowBoxes)
+	{
+		getRenderQueue()->addRenderable(octant->getWireBoundingBox());
+		++mNumObjects;
+	}
+
 	SceneManager::_renderVisibleObjects();
 
-	// delete all rendered objects from renderqueue
+	// delete all rendered objects from the render queue
 	_deleteRenderedQueueGroups();
 }
-#endif // OGRE_COHERENT_OCCLUSION_CULLING
-}
+#endif // GTP_VISIBILITY_MODIFIED_OGRE
+}
Index: trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp	(revision 97)
+++ trunk/VUT/work/ogre_changes/RenderSystems/GL/src/OgreGLHardwareOcclusionQuery.cpp	(revision 99)
@@ -161,6 +161,6 @@
 
 	// Check for hardware occlusion support
-    // if( glDeleteOcclusionQueriesNV_ptr != 0 )	// This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported.
-	if( glDeleteQueriesARB_ptr != 0 )
+    if ( glDeleteOcclusionQueriesNV_ptr != 0 )	// This is a hack to see if hw occlusion is supported. pointer is 0 if it's not supported.
+	//if ( glDeleteQueriesARB_ptr != 0 )
 	{
 		m_bHWOcclusionSupport = true;
@@ -171,8 +171,8 @@
 	}
 
-	if( m_bHWOcclusionSupport )
-	{
-		//glGenOcclusionQueriesNV_ptr( 1, m_uintQuery );	
-		glGenQueriesARB_ptr(1, m_uintQuery);
+	if ( m_bHWOcclusionSupport )
+	{
+		glGenOcclusionQueriesNV_ptr( 1, m_uintQuery );	
+		//glGenQueriesARB_ptr(1, m_uintQuery);
 	}
 }
@@ -182,8 +182,8 @@
 GLHardwareOcclusionQuery::~GLHardwareOcclusionQuery() 
 { 
-	if( m_bHWOcclusionSupport )
-	{
-		//glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] );  
-		glDeleteQueriesARB_ptr(1, &m_uintQuery[0]);
+	if ( m_bHWOcclusionSupport )
+	{
+		glDeleteOcclusionQueriesNV_ptr( 1, &m_uintQuery[0] );  
+		//glDeleteQueriesARB_ptr(1, &m_uintQuery[0]);
 	}	
 }
@@ -192,9 +192,9 @@
 void GLHardwareOcclusionQuery::beginOcclusionQuery() 
 { 
-	if( m_bHWOcclusionSupport )	// Make it fail silently if hardware occlusion isn't supported
+	if ( m_bHWOcclusionSupport )	// Make it fail silently if hardware occlusion isn't supported
 	{
 		// do the actual occlusion query for this node
-		//glBeginOcclusionQueryNV_ptr( m_uintQuery[0] );
-		glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, m_uintQuery[0]);
+		glBeginOcclusionQueryNV_ptr( m_uintQuery[0] );
+		//glBeginQueryARB_ptr(GL_SAMPLES_PASSED_ARB, m_uintQuery[0]);
 	}
 }
@@ -202,8 +202,8 @@
 void GLHardwareOcclusionQuery::endOcclusionQuery() 
 { 
-	if( m_bHWOcclusionSupport )	// Make it fail silently if hardware occlusion isn't supported
-	{
-		//glEndOcclusionQueryNV_ptr();
-		glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB);
+	if ( m_bHWOcclusionSupport )	// Make it fail silently if hardware occlusion isn't supported
+	{
+		glEndOcclusionQueryNV_ptr();
+		//glEndQueryARB_ptr(GL_SAMPLES_PASSED_ARB);
 	}
 }
@@ -211,19 +211,19 @@
 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult) 
 {
-	//unsigned int isAvailable = GL_TRUE;
-	int isAvailable = GL_TRUE;
+	unsigned int isAvailable = GL_TRUE;
+	//int isAvailable = GL_TRUE;
 
 	if( m_bHWOcclusionSupport )	
 	{
-		if(!waitForResult)
-		{
-			//glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable );
-			glGetQueryivARB_ptr(m_uintQuery[0], GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable);
-		}
-
-		if(isAvailable == GL_TRUE)
-		{
-			glGetQueryObjectuivARB_ptr( m_uintQuery[0], GL_QUERY_RESULT_ARB, NumOfFragments);
-			//glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments );
+		if (!waitForResult)
+		{
+			glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable );
+			//glGetQueryivARB_ptr(m_uintQuery[0], GL_QUERY_RESULT_AVAILABLE_ARB, &isAvailable);
+		}
+
+		if (isAvailable == GL_TRUE)
+		{
+			glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments );
+			//glGetQueryObjectuivARB_ptr( m_uintQuery[0], GL_QUERY_RESULT_ARB, NumOfFragments);
 		}
 	} 
