Index: trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
===================================================================
--- trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 164)
+++ trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp	(revision 171)
@@ -9,5 +9,4 @@
 #include "OgreVisibilityTerrainSceneManager.h"
 #include "VisibilityInfo.h"
-#include "OgreItemBufferQueryManager.h"
 #include "OgreOcclusionQueriesQueryManager.h"
 #include "TestCullingTerrainApplication.h"
@@ -414,15 +413,8 @@
 		dynamic_cast<VisibilityTerrainSceneManager *>(mSceneMgr);
 
-	if (useItemBuffer)
-	{
-		mQueryManager = new ItemBufferQueryManager(sm->GetHierarchyInterface(), 
-			mWindow->getViewport(0), mRenderPatchesForItemBuffer);
-	}
-	else
-	{
-		mQueryManager = new OcclusionQueriesQueryManager(sm->GetHierarchyInterface(), 
-			mWindow->getViewport(0));
-	}
-
+	mQueryManager = new OcclusionQueriesQueryManager(sm->GetHierarchyInterface(),
+			mWindow->getViewport(0), false, useItemBuffer);
+	//mQueryManager = new PlatformQueryManager(sm->GetHierarchyInterface(),	mWindow->getViewport(0), false);
+	
 	sm->GetVisibilityManager()->SetQueryManager(mQueryManager);
 
@@ -431,4 +423,5 @@
 	InfoContainer<GtpVisibility::PatchInfo> visiblePatches;
 
+
 	if (fromPoint)
 	{
@@ -442,4 +435,11 @@
 			    &visibleNodes, &visibleGeometry, &visiblePatches, relativeVisibility);
 	}
+		
+	std::stringstream d; 
+	d << queryTypeCaptions[fromPoint ?  1 : 0].c_str() << " "
+	  << queryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " "
+      << queryMethodCaptions[useItemBuffer ? 1 : 0].c_str();
+	LogManager::getSingleton().logMessage(d.str());
+
 
 	float averageNodeVis = 0, averageGeometryVis = 0, averagePatchVis = 0;
@@ -457,7 +457,9 @@
 	
 			averageGeometryVis += vis;
-			++geomSize;
+			++ geomSize;
 			
-			std::stringstream d; d << "Geometry " << geomSize << " visibility: " << vis;
+			std::stringstream d; 
+			d << "Geometry " << geomSize << " id: " << (*geomIt).GetMesh()->getSubEntity(0)->getId() 
+			  << " visibility: "  << (*geomIt).GetVisiblePixels() << ", " << (*geomIt).GetProjectedPixels();
 			LogManager::getSingleton().logMessage(d.str());
 		}
@@ -475,5 +477,5 @@
 		
 			averageNodeVis += vis;
-			++nodesSize;
+			++ nodesSize;
 
 			std::stringstream d; d << "Node visibility: " << vis;
@@ -484,5 +486,5 @@
 	InfoContainer<GtpVisibility::PatchInfo>::iterator patchIt, patchIt_end = visiblePatches.end();
 
-	for (patchIt = visiblePatches.begin(); patchIt != patchIt_end; ++patchIt)
+	for (patchIt = visiblePatches.begin(); patchIt != patchIt_end; ++ patchIt)
 	{
 		// add if not 0
@@ -493,5 +495,5 @@
 		
 			averagePatchVis += vis;
-			++patchSize;
+			++ patchSize;
 
 			std::stringstream d; d << "Patch visibility: " << vis;
@@ -1410,7 +1412,9 @@
 	    
 	initOverlayElement(&mQueryTypeInfo , ext, "QueryType", top,	": 0"); top += vert_space;
+	
+	initOverlayElement(&mQueryVisibleNodesInfo , ext, "VisibleNodes", top,	": 0"); top += vert_space;
 	initOverlayElement(&mQueryVisibleGeometryInfo , ext, "VisibleGeometry", top,	": 0"); top += vert_space;
-	initOverlayElement(&mQueryVisibleNodesInfo , ext, "VisibleNodes", top,	": 0"); top += vert_space;
 	initOverlayElement(&mQueryVisiblePatchInfo , ext, "VisiblePatches", top,	": 0"); top += vert_space;
+	
 	initOverlayElement(&mQueryNodeVisibilityInfo , ext, "NodeVisibility", top,	": 0"); top += vert_space;
 	initOverlayElement(&mQueryGeometryVisibilityInfo , ext, "GeometryVisibility", top,	": 0"); top += vert_space;
Index: trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9RenderWindow.cpp
===================================================================
--- trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9RenderWindow.cpp	(revision 166)
+++ trunk/VUT/work/ogre_changes/RenderSystems/Direct3D9/src/OgreD3D9RenderWindow.cpp	(revision 171)
@@ -928,4 +928,5 @@
 		HRESULT hr;
 		LPDIRECT3DSURFACE9 pSurf=NULL, pTempSurf=NULL;
+		//IDirect3DSurface9 *pTempSurf=NULL;
 		D3DSURFACE_DESC desc;
 		D3DDISPLAYMODE dm;
@@ -953,6 +954,6 @@
 		}
 
-		//if (FAILED(hr = mpD3DDevice->GetFrontBufferData(0, pTempSurf)))
-		if (FAILED(hr = mpD3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pTempSurf)))
+		if (FAILED(hr = mpD3DDevice->GetFrontBufferData(0, pTempSurf)))
+		//if (FAILED(hr = mpD3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pTempSurf)))
 		{
 			SAFE_RELEASE(pTempSurf);
@@ -1058,5 +1059,5 @@
 		}
 
-		pTempSurf->UnlockRect();
+//pTempSurf->UnlockRect();
 		SAFE_RELEASE(pTempSurf);
 		SAFE_RELEASE(pSurf);
