Index: GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2017)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 2023)
@@ -196,5 +196,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG"
 				RuntimeLibrary="2"
 				EnableEnhancedInstructionSet="2"
@@ -314,5 +314,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;QtInterface"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_QT;TRY_GLOBAL_LINES"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_QT"
 				RuntimeLibrary="2"
 				RuntimeTypeInfo="TRUE"
Index: GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp	(revision 2002)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp	(revision 2023)
@@ -102,5 +102,4 @@
 	if (sUseArbQueries)
 	{
-//		GLint sampleCount;
 		glGetQueryObjectuivARB(mId, GL_QUERY_RESULT_ARB, &sampleCount);
 		return sampleCount;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2021)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 2023)
@@ -1194,4 +1194,5 @@
 	}
 	
+	// reserve constant block of rays
 	mRayCaster->ReserveVssRayPool(2*mSamplesPerPass);
 	
@@ -1212,5 +1213,5 @@
 #if 1
   mRayCaster->SortRays(rays);
-  cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl;
+  //cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl;
 
   if (0) {
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2017)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 2023)
@@ -222,5 +222,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(CG_INC_PATH)&quot;"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_CG"
 				ExceptionHandling="TRUE"
 				RuntimeLibrary="2"
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2021)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2023)
@@ -25,5 +25,5 @@
 #include "SceneGraph.h"
 
-#include "PerfTimer.h"
+//#include "PerfTimer.h"
 
 
@@ -39,7 +39,7 @@
 
 
-PerfTimer viewCellCastTimer;
-PerfTimer pvsTimer;
-PerfTimer objTimer;
+//PerfTimer viewCellCastTimer;
+//PerfTimer pvsTimer;
+//PerfTimer objTimer;
 
 // HACK
@@ -510,10 +510,12 @@
 			mPreprocessor->GetRenderer()->mViewPoint = viewPoint;
 			mPreprocessor->GetRenderer()->mViewDirection = direction;
-
-			if (mPreprocessor->GetRenderer()->ValidViewPoint())
+			//preprocessor->renderer->EvalPvsStat();
+cout<<"*********hgere55"<<endl;
+			if (preprocessor->renderer->ValidViewPoint())
 			{
 				cout << "view point valid" << endl;
 				break;
 			}
+			cout<<"here33"<<endl;
 		}
 
@@ -1999,6 +2001,6 @@
 	}
 
-  cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
-  cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
+  //cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
+ // cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
   
   return sum;
@@ -2698,5 +2700,5 @@
 	ViewCell::NewMail();
 	
-	viewCellCastTimer.Entry();
+	//viewCellCastTimer.Entry();
 
 	static ViewCellContainer viewCells;
@@ -2712,5 +2714,5 @@
 	}
 	
-	viewCellCastTimer.Exit();
+	//viewCellCastTimer.Exit();
 
 	mSamplesStat.mViewCells += (int)viewCells.size();
@@ -2738,5 +2740,5 @@
 	//	objTimer.Exit();
 	
-	pvsTimer.Entry();
+	//pvsTimer.Entry();
 
 	ViewCellContainer::const_iterator it = viewCells.begin();
@@ -2751,5 +2753,5 @@
 	}
 
-	pvsTimer.Exit();
+	//pvsTimer.Exit();
 
 	mSamplesStat.mPvsContributions += ray.mPvsContribution;
Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2017)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2023)
@@ -349,5 +349,6 @@
 {
   Vector3 target = mViewPoint + mViewDirection;
-
+  //cout << "vp: " << mViewPoint << " dr: " << mViewDirection << endl;
+  //cout<<"box: " << mKdTree->GetBox()<<endl;
   Vector3 up(0,1,0);
   
@@ -859,5 +860,5 @@
 GlRendererBuffer::EvalPvsStat()
 {
-
+cout<<"here15"<<endl;
   MakeCurrent();
 
@@ -865,5 +866,5 @@
   
   DoneCurrent();
-  
+  cout<<"here185"<<endl;
   //  mRenderingFinished.wakeAll();
 }
@@ -1289,9 +1290,19 @@
 }
 
+bool GlRendererBuffer::ValidViewPoint()
+{	cout << "here49" << endl;
+	/*MakeCurrent();
+
+	bool result = GlRenderer::ValidViewPoint();
+	DoneCurrent();
+*/bool result = true;
+	return result;
+}
+
 
 void
 GlRenderer::EvalPvsStat()
 {
-
+cout <<"here3399"<<endl;
   mPvsStat.Reset();
   halton.Reset();
@@ -1375,5 +1386,5 @@
   glCullFace(GL_BACK);
   
-  //  cout<<"VV1 ";
+  //cout<<"VV1 ";
   RenderScene();
   
@@ -1405,6 +1416,7 @@
   
   if (pixelCount > 0)
+  {cout<<"count: " << pixelCount<<endl;
 	return false; // backfacing polygon found -> not a valid viewspace sample
-
+  }
   return true;
 }
Index: GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2020)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 2023)
@@ -175,7 +175,7 @@
 
 	InitTiming();
+	Debug.open("debug.log");
+
 #if 0
-	Debug.open("debug.log");
-
 	cout<<"Allocating 1.5GB..."<<endl;
 
@@ -192,4 +192,5 @@
 	}
 #endif
+	
 	Environment::GetSingleton()->Parse(argc, argv, USE_EXE_PATH);
 	MeshKdTree::ParseEnvironment();
@@ -205,4 +206,5 @@
 		exit(1);
 	}
+
 
 	Environment::GetSingleton()->GetStringValue("Scene.filename", buff);
@@ -283,7 +285,9 @@
 	}
 
-	const string viewCellsFile = ReplaceSuffix(filename, ".obj", ".vc");
-	const int numViewCells = 2;
-	const int numViewPoints = 2;
+	string viewCellsFile = ReplaceSuffix(filename, ".obj", ".vc");
+	viewCellsFile = ReplaceSuffix(filename, ".dat", ".vc");
+
+	const int numViewCells = 5;
+	const int numViewPoints = 20;
 
 	bool useHwGlobalLines;
@@ -361,5 +365,5 @@
 		Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames);
 		
-		if (frames) 
+		if (1)//frames) 
 		{
 			// NOTE: render texture should be power of 2 and square
@@ -373,5 +377,5 @@
 		}
 
-	/*	vector<ViewCellPoints *> myViewCells;
+		vector<ViewCellPoints *> myViewCells;
 
 		preprocessor->mViewCellsManager->GenerateRandomViewCells(myViewCells, numViewCells, numViewPoints);
@@ -381,5 +385,7 @@
 		//preprocessor->mViewCellsManager->ImportRandomViewCells(viewCellsFile, myViewCells);
 		CLEAR_CONTAINER(myViewCells);
-*/
+
+		//preprocessor->renderer->EvalPvsStat();
+
 		qApp->exec();
 #endif
Index: GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2021)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/CombinedPreprocessor.cpp	(revision 2023)
@@ -14,12 +14,12 @@
 #include "RayCaster.h"
 
-#include "PerfTimer.h"
+//#include "PerfTimer.h"
 
 
 namespace GtpVisibilityPreprocessor {
 
-  extern PerfTimer viewCellCastTimer;
-  extern PerfTimer pvsTimer;
-  extern PerfTimer objTimer;
+  //extern PerfTimer viewCellCastTimer;
+  //extern PerfTimer pvsTimer;
+  //extern PerfTimer objTimer;
 
 const bool pruneInvalidRays = true;
@@ -94,7 +94,7 @@
 	mMixtureDistribution->ComputeContributions(vssRays);
 
-	cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
-	cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
-	cout<<"obj time:"<<objTimer.TotalTime()<<" s"<<endl;
+	//cout<<"view cell cast time:"<<viewCellCastTimer.TotalTime()<<" s"<<endl;
+	//cout<<"pvs time:"<<pvsTimer.TotalTime()<<" s"<<endl;
+	//cout<<"obj time:"<<objTimer.TotalTime()<<" s"<<endl;
 
 	if (mExportRays) {
Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2017)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h	(revision 2023)
@@ -145,6 +145,5 @@
   SetupProjection(const int w, const int h, const float angle = 70.0f);
 
-  virtual bool
-  ValidViewPoint();
+  virtual bool ValidViewPoint();
   
   virtual float
@@ -280,4 +279,5 @@
 	virtual void DoneCurrent() = 0;
 
+	virtual bool ValidViewPoint();
 
 	virtual void SampleBeamContributions(
Index: GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 2019)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp	(revision 2023)
@@ -7,9 +7,9 @@
 #include "RssTree.h"
 #include "Mutation.h"
-#include "PerfTimer.h"
+//#include "PerfTimer.h"
 
 namespace GtpVisibilityPreprocessor {
 
-extern PerfTimer pvsTimer;
+//extern PerfTimer pvsTimer;
 
 //HaltonSequence SamplingStrategy::sHalton;
@@ -662,5 +662,5 @@
 					if (strcmp(curr, "mutation")==0) {
 					  // temp matt: still no mutationstrategy!
-					  mDistributions.push_back(new MutationBasedDistribution(mPreprocessor));
+					  //mDistributions.push_back(new MutationBasedDistribution(mPreprocessor));
 					}
 	
