Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2678)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2679)
@@ -1022,9 +1022,9 @@
 GlRendererBuffer::EvalPvsStat()
 {
-	MakeLive();
+	//MakeLive();
 	
 	GlRenderer::EvalPvsStat();
 	
-	DoneLive();
+	//DoneLive();
 	// mRenderingFinished.wakeAll();
 }
@@ -1033,9 +1033,9 @@
 void GlRendererBuffer::EvalPvsStat(const SimpleRayContainer &viewPoints)
 {
-	MakeLive();
+	//MakeLive();
 
 	GlRenderer::EvalPvsStat(viewPoints);
   
-	DoneLive();
+	//DoneLive();
 }
 
@@ -1476,91 +1476,92 @@
 GlRenderer::EvalPvsStat()
 {
-  mPvsStat.Reset();
-  halton.Reset();
-
-  SetupProjection(GetWidth(), GetHeight());
-
-  cout << "Random Pvs STATS, mPvsStatFrames=" << mPvsStatFrames << endl;
-  
-  for (int i=0; i < mPvsStatFrames; i++) {
-	float err;
-	// set frame id for saving the error buffer
-	mFrame = i;
-
-	//	cerr<<"RV"<<endl;
-	RandomViewPoint();
-	//	cerr<<"RV2"<<endl;
-
- 	if (mPvsErrorBuffer[i].mError == 1.0f) {
-	  // check if the view point is valid
-	  if (!ValidViewPoint()) {
-		mPvsErrorBuffer[i].mError = -1.0f;
-	  }
-
-	  // manualy corrected view point
-	  if (mFrame == 5105)
-		mPvsErrorBuffer[i].mError = -1.0f;
-	}
-
-
-	if (mPvsErrorBuffer[i].mError > 0.0f) {
-		int pvsSize;
-
-		float error = GetPixelError(pvsSize);
-
-		mPvsErrorBuffer[i].mError = error;
-		mPvsErrorBuffer[i].mPvsSize = pvsSize;
-
-		//cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")";
-	}
-
-	err = mPvsErrorBuffer[i].mError;
-	
-	if (err >= 0.0f) {
-	  if (err > mPvsStat.maxError)
-		mPvsStat.maxError = err;
-	  mPvsStat.sumError += err;
-	  mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize;
-	  
-	  if (err == 0.0f)
-		mPvsStat.errorFreeFrames++;
-	  mPvsStat.frames++;
-	}
-  }
-  
-  glFinish();
-
-  static bool first = true;
-  if (first) {
-	
-
-	bool exportRandomViewCells;
-	Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells",
-											  exportRandomViewCells);
-	
-	if (0 && exportRandomViewCells)
-	  {
-		char buff[512];
-		Environment::GetSingleton()->GetStringValue("Scene.filename", buff);
-		string filename(buff);
-
-		string viewCellPointsFile;
-		
-		if (strstr(filename.c_str(), ".obj"))
-		  viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc");
-		else if (strstr(filename.c_str(), ".dat"))
-		  viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc");
-		else if (strstr(filename.c_str(), ".x3d"))
-		  viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc");
-		
-		
-		cout << "exporting random view cells" << endl;
-		preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile);
-		cout << "finished" << endl;
-	  }
-	first = false;
-  }
-
-  cout<<endl<<flush;
+	mPvsStat.Reset();
+	halton.Reset();
+
+	SetupProjection(GetWidth(), GetHeight());
+
+	cout << "Random Pvs STATS, mPvsStatFrames=" << mPvsStatFrames << endl;
+
+	for (int i=0; i < mPvsStatFrames; i++) {
+		float err;
+		// set frame id for saving the error buffer
+		mFrame = i;
+
+		//	cerr<<"RV"<<endl;
+		RandomViewPoint();
+		//	cerr<<"RV2"<<endl;
+
+		if (mPvsErrorBuffer[i].mError == 1.0f) {
+			// check if the view point is valid
+			if (!ValidViewPoint()) {
+				mPvsErrorBuffer[i].mError = -1.0f;
+			}
+
+			// manualy corrected view point
+			if (mFrame == 5105)
+				mPvsErrorBuffer[i].mError = -1.0f;
+		}
+
+
+		if (mPvsErrorBuffer[i].mError > 0.0f) 
+		{
+			int pvsSize;
+
+			float error = GetPixelError(pvsSize);
+
+			mPvsErrorBuffer[i].mError = error;
+			mPvsErrorBuffer[i].mPvsSize = pvsSize;
+
+			//cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")";
+		}
+
+		err = mPvsErrorBuffer[i].mError;
+
+		if (err >= 0.0f) {
+			if (err > mPvsStat.maxError)
+				mPvsStat.maxError = err;
+			mPvsStat.sumError += err;
+			mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize;
+
+			if (err == 0.0f)
+				mPvsStat.errorFreeFrames++;
+			mPvsStat.frames++;
+		}
+	}
+
+	glFinish();
+
+	static bool first = true;
+	if (first) {
+
+
+		bool exportRandomViewCells;
+		Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells",
+			exportRandomViewCells);
+
+		if (0 && exportRandomViewCells)
+		{
+			char buff[512];
+			Environment::GetSingleton()->GetStringValue("Scene.filename", buff);
+			string filename(buff);
+
+			string viewCellPointsFile;
+
+			if (strstr(filename.c_str(), ".obj"))
+				viewCellPointsFile = ReplaceSuffix(filename, ".obj", ".vc");
+			else if (strstr(filename.c_str(), ".dat"))
+				viewCellPointsFile = ReplaceSuffix(filename, ".dat", ".vc");
+			else if (strstr(filename.c_str(), ".x3d"))
+				viewCellPointsFile = ReplaceSuffix(filename, ".x3d", ".vc");
+
+
+			cout << "exporting random view cells" << endl;
+			preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile);
+			cout << "finished" << endl;
+		}
+		first = false;
+	}
+
+	cout<<endl<<flush;
 }
 
@@ -1580,5 +1581,5 @@
 	for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i) 
 	{
-		if ((i % 10) == 99)
+		if ((i % 100) == 99)
 			cout << "processed " << i << " view points " << endl;
 
@@ -1603,4 +1604,5 @@
 
 			const int pixelError = (int)mPvsErrorBuffer[i].mError * GetWidth() * GetHeight();
+
 			if (0 && (pixelError > 0) && (pvsSize > 0)) 
 			{
@@ -1623,5 +1625,5 @@
 				mPvsStat.maxError = err;
 
-				cout << "new max error: " << mPvsStat.maxError * GetWidth()*GetHeight()  << endl;
+				cout << "new max error: " << mPvsStat.maxError * GetWidth() * GetHeight()  << endl;
 			}
 
