Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2617)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp	(revision 2619)
@@ -21,4 +21,5 @@
 #define USE_CG 1
 
+#define TEST_PVS_RENDERING 1
 
 #if USE_CG
@@ -132,4 +133,5 @@
 	glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 
 
+	
 	// Render PVS
 	ObjectPvsIterator it = pvs.GetIterator();
@@ -139,4 +141,5 @@
 
 	Intersectable::NewMail();
+	mCurrentFrame++;
 	while (it.HasMoreEntries()) 
 	  {
@@ -176,5 +179,5 @@
 
 
-	if (mSnapErrorFrames && (0 && pErrorPixels >= 0.01f)) {
+	if (mSnapErrorFrames && (pErrorPixels >= 0.01f)) {
 	  glReadBuffer(GL_BACK);
 	  //glReadBuffer(GL_FRONT);
@@ -211,4 +214,5 @@
 	  // Render PVS
 	  Intersectable::NewMail();
+	  mCurrentFrame++;
 	  
 	  
@@ -220,5 +224,4 @@
 
 	  mUseForcedColors = false;
-	  
 	  im = toImage();
 	  sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels);
@@ -371,5 +374,23 @@
 void QtGlRendererWidget::_RenderPvs()
 {
-	mUseFalseColors = false;
+
+#if TEST_PVS_RENDERING
+  
+  ObjectPvsIterator it = mPvsCache.mPvs.GetIterator();
+
+  int pvsSize = mPvsCache.mPvs.GetSize();
+
+  Intersectable::NewMail();
+  mCurrentFrame++;
+  while (it.HasMoreEntries()) 
+	{
+	  RenderIntersectable(it.Next());
+	}
+
+  
+  return;
+#endif
+  
+  mUseFalseColors = false;
 
 	int offset = (int)mObjects.size() * 3;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2618)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 2619)
@@ -2591,11 +2591,11 @@
 
 	// check if last ray was not same ray with reverse direction
-	//	if (1) 
+	if (1) 
 		// tmp matt: don't use when origin objects are not accounted for, currently the second ray is lost!!
 	  // $$JB: reenabled again - should use the same viewcells for the next ray ray if
 	  // it goes in the oposite direction
-	if (!lastVssRay ||
-		!(ray.mOrigin == lastVssRay->mTermination) ||
-		!(ray.mTermination == lastVssRay->mOrigin)) 
+	//	if (!lastVssRay ||
+	//		!(ray.mOrigin == lastVssRay->mTermination) ||
+	//		!(ray.mTermination == lastVssRay->mOrigin)) 
 	  {
 #ifdef USE_PERFTIMER  
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2616)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2619)
@@ -26,5 +26,5 @@
 
 // if 1 = SAFE RENDERING OF PVS primitives without VBOs for Pvs error estimation
-#define EVAL_ERROR 0
+#define EVAL_ERROR 1
 
 namespace GtpVisibilityPreprocessor {
@@ -89,10 +89,14 @@
 	mSceneGraph->CollectObjects(mObjects);
 
-#if 1
+#if 0
 	viewCellsManager->GetViewPoint(mViewPoint);
 	mViewDirection = Vector3(0,0,1);
 #else
-	mViewPoint = Vector3(1099.9,183.0,-387);
-	mViewDirection = Vector3(-0.6,0,-0.8);
+	
+	mViewPoint = Vector3(1213.85, 176.988, -437.364);
+	mViewDirection = Vector3(0.433884, 0, -0.900969);
+	
+	//mViewPoint = Vector3(1099.9,183.0,-387);
+	//mViewDirection = Vector3(-0.6,0,-0.8);
 #endif
 	mFrame = 0;
@@ -151,6 +155,6 @@
 void GlRenderer::RenderIntersectable(Intersectable *object)
 {
-	if (!object || (object->mRenderedFrame == mCurrentFrame))
-		return;
+  if (!object || (object->mRenderedFrame == mCurrentFrame))
+	return;
 
 	object->mRenderedFrame = mCurrentFrame;
@@ -448,7 +452,8 @@
 GlRenderer::_RenderScene()
 {
-	ObjectContainer::const_iterator oi = mObjects.begin();
-	for (; oi != mObjects.end(); oi++)
-		RenderIntersectable(*oi);
+  
+  ObjectContainer::const_iterator oi = mObjects.begin();
+  for (; oi != mObjects.end(); oi++)
+	RenderIntersectable(*oi);
 }
 
@@ -531,5 +536,7 @@
 GlRenderer::RenderScene()
 {
-	Intersectable::NewMail();
+  mCurrentFrame++;
+  
+  Intersectable::NewMail();
 #if DYNAMIC_OBJECTS_HACK
 	Preprocessor *p = mViewCellsManager->GetPreprocessor();
@@ -832,16 +839,16 @@
 		RenderKdLeaf(static_cast<KdLeaf *>(node));
 #else
-		KdLeaf *leaf = (KdLeaf *)node;
+		KdLeaf *leaf = static_cast<KdLeaf *>(node);
 		for (int i=0; i < leaf->mObjects.size(); i++) 
-		{
+		  {
 			RenderIntersectable(leaf->mObjects[i]);
-		}
+		  }
 #endif
 	} 
 	else 
 	{
-		KdInterior *in = (KdInterior *)node;
-		RenderKdNode(in->mBack);
-		RenderKdNode(in->mFront);
+		KdInterior *inter = static_cast<KdInterior *>(node);
+		RenderKdNode(inter->mBack);
+		RenderKdNode(inter->mFront);
 	}
 }
@@ -1477,4 +1484,5 @@
 	// set frame id for saving the error buffer
 	mFrame = i;
+
 	//	cerr<<"RV"<<endl;
 	RandomViewPoint();
@@ -1516,5 +1524,5 @@
 	  //	  emit UpdatePvsErrorItem(i,
 	  //							  mPvsErrorBuffer[i]);
-	  cout<<"("<<i<<","<<mPvsErrorBuffer[i].mError<<")";
+	  cout<<"("<<i<<" ["<<mViewPoint<<"]["<<mViewDirection<<"] "<<mPvsErrorBuffer[i].mError<<")";
 	  //	  swapBuffers();
 	}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/SG08/run_test_pixel
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/SG08/run_test_pixel	(revision 2613)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/SG08/run_test_pixel	(revision 2619)
@@ -4,5 +4,5 @@
 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+"
 #COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -samples_per_pass=500000 -samples_per_evaluation=10000000 -total_samples=500000000 -preprocessor_pvs_rendererror_samples=10000 -preprocessor_evaluatePixelError+"
-COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer- -preprocessor_evaluate_filter- -samples_per_pass=1000000 -samples_per_evaluation=10000000 -total_samples=500000000 -preprocessor_pvs_rendererror_samples=10000 -preprocessor_evaluatePixelError+ -preprocessor_detect_empty_viewspace+ -kd_pvs_area=1e-4"
+COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish+ -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_pass=500000 -samples_per_evaluation=100000 -total_samples=500000000 -preprocessor_pvs_rendererror_samples=100 -preprocessor_evaluatePixelError+ -preprocessor_detect_empty_viewspace+ -kd_pvs_area=1e-5 -view_cells_use_kd_pvs+ -af_use_kd_pvs+"
 
 #SCENE="../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d"
@@ -35,5 +35,5 @@
 #VIEWCELLS=../data/vienna/vienna-seq-viewcells-20000.xml.gz
 
-PREFIX=../work/plots/osp-vienna-SG08-PIXEL
+PREFIX=../work/plots/osp-vienna-SG08c-PIXEL
 
 #SCENE=../data/atlanta/atlanta2.x3d
@@ -43,5 +43,4 @@
 $COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \
 -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \
--view_cells_use_kd_pvs+ -af_use_kd_pvs+ \
 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4l.xml \
 -preprocessor_stats=$PREFIX-i-mixed-b1-n4l.log \
