Index: GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2539)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp	(revision 2543)
@@ -5,5 +5,4 @@
 #include "ViewCellsManager.h"
 #include "SceneGraph.h"
-//#include "ObjectPvs.h"
 #include "Viewcell.h"
 #include "Beam.h"
@@ -71,48 +70,38 @@
 					   ViewCellsManager *viewCellsManager,
 					   KdTree *tree):
-  Renderer(sceneGraph, viewCellsManager),
-  mKdTree(tree),
-  mUseFalseColors(false),
-  mVboId(-1),
-  mData(NULL),
-  mIndices(NULL),
-  mUseVbos(true)
-  //mUseVbos(false)
-{
-  mSceneGraph->CollectObjects(&mObjects);
-
-  //  mViewCellsManager->GetViewPoint(mViewPoint);
-
-  viewCellsManager->GetViewPoint(mViewPoint);
-	//mSceneGraph->GetBox().Center();
-  mViewDirection = Vector3(0,0,1);
-
-  //  mViewPoint = Vector3(991.7, 187.8, -271);
-  //  mViewDirection = Vector3(0.9, 0, -0.4);
-
-  //  timerId = startTimer(10);
-  // debug coords for atlanta
-  //  mViewPoint = Vector3(3473, 6.778, -1699);
-  //  mViewDirection = Vector3(-0.2432, 0, 0.97);
-  
-  mFrame = 0;
-  mWireFrame = false;
-  Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace",
-											mDetectEmptyViewSpace);
-  mSnapErrorFrames = true;
-  mSnapPrefix = "snap/";
-  mUseForcedColors = false;
-  mRenderBoxes = false;
-  mUseGlLists = true;
-  //mUseGlLists = false;
-
-  if (mViewCellsManager->GetViewCellPoints()->size())
-	mPvsStatFrames = (int)mViewCellsManager->GetViewCellPoints()->size();
-  else
-	Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames);
-
-
-  mPvsErrorBuffer.resize(mPvsStatFrames);
-  ClearErrorBuffer();
+Renderer(sceneGraph, viewCellsManager),
+mKdTree(tree),
+mUseFalseColors(false),
+mVboId(-1),
+mData(NULL),
+mIndices(NULL),
+mUseVbos(true),
+mCurrentFrame(-1)
+{
+	mSceneGraph->CollectObjects(&mObjects);
+
+	viewCellsManager->GetViewPoint(mViewPoint);
+
+	mViewDirection = Vector3(0,0,1);
+
+	mFrame = 0;
+	mWireFrame = false;
+	Environment::GetSingleton()->GetBoolValue("Preprocessor.detectEmptyViewSpace",
+		                                      mDetectEmptyViewSpace);
+	mSnapErrorFrames = true;
+	mSnapPrefix = "snap/";
+	mUseForcedColors = false;
+	mRenderBoxes = false;
+	//mUseGlLists = true;
+	mUseGlLists = false;
+
+	if (mViewCellsManager->GetViewCellPoints()->size())
+		mPvsStatFrames = (int)mViewCellsManager->GetViewCellPoints()->size();
+	else
+		Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames);
+
+
+	mPvsErrorBuffer.resize(mPvsStatFrames);
+	ClearErrorBuffer();
 }
 
@@ -120,133 +109,146 @@
 GlRenderer::~GlRenderer()
 {
-  cerr<<"gl renderer destructor..\n";
- 
-  CLEAR_CONTAINER(mOcclusionQueries);
-
-  DeleteVbos();
-
-  if (mData) delete [] mData;
-  if (mIndices) delete [] mIndices;
-
-  glDeleteBuffersARB(1, &mVboId);
-  cerr<<"done."<<endl;
-}
-
-
-void
-GlRenderer::RenderTriangle(TriangleIntersectable *object)
-{
-  Triangle3 &t = object->GetItem();
-
-  glBegin(GL_TRIANGLES);
-  Vector3 normal = t.GetNormal();
-  glNormal3f(normal.x, normal.y, normal.z);
-  glVertex3f(t.mVertices[0].x, t.mVertices[0].y, t.mVertices[0].z);
-  glVertex3f(t.mVertices[1].x, t.mVertices[1].y, t.mVertices[1].z);
-  glVertex3f(t.mVertices[2].x, t.mVertices[2].y, t.mVertices[2].z);
-  glEnd();
-}
-
-void
-GlRenderer::RenderIntersectable(Intersectable *object)
-{
-  if (!object)
-	return;
-  
-  if (object->Mailed())
-	return;
-
-  object->Mail();
-  
-  glPushAttrib(GL_CURRENT_BIT);
-  if (mUseFalseColors)
-	SetupFalseColor(object->mId);
-  
-  switch (object->Type()) {
-  case Intersectable::MESH_INSTANCE:
-	RenderMeshInstance((MeshInstance *)object);
-	break;
-  case Intersectable::VIEW_CELL:
-	RenderViewCell(static_cast<ViewCell *>(object));
-	break;
-  case Intersectable::TRANSFORMED_MESH_INSTANCE:
-	RenderTransformedMeshInstance(static_cast<TransformedMeshInstance *>(object));
-	break;
-  case Intersectable::TRIANGLE_INTERSECTABLE:
-	RenderTriangle(static_cast<TriangleIntersectable *>(object));
-	break;
-  case Intersectable::BVH_INTERSECTABLE: {
-
-	BvhNode *node = static_cast<BvhNode *>(object);
-	
-	if (mRenderBoxes)
-	  RenderBox(node->GetBoundingBox());
-	else
-	  RenderBvhNode(node);
-	break;
-  }
-  case Intersectable::KD_INTERSECTABLE: {
-	KdNode *node = (static_cast<KdIntersectable *>(object))->GetItem();
-	
-	if (mRenderBoxes)
-	  RenderBox(mKdTree->GetBox(node));
-	else
-	  RenderKdNode(node);
-	break;
-  }
-	
-  default:
-	cerr<<"Rendering this object not yet implemented\n";
-	break;
-  }
-
-  glPopAttrib();
-}
-
-void
-GlRenderer::RenderRays(const VssRayContainer &rays)
-{
-  VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end();
-
-  glBegin(GL_LINES);
-  for (; it != it_end; ++it) {
-	VssRay *ray = *it;
-	float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f;
-	//	cout<<"w="<<ray->mWeightedPvsContribution<<" r="<<ray->mWeightedPvsContribution;
-	glColor3f(importance, importance, importance);
-	glVertex3fv(&ray->mOrigin.x);
-	glVertex3fv(&ray->mTermination.x);
-  }
-  glEnd();
-}
-
-
-
-void
-GlRenderer::RenderViewCell(ViewCell *vc)
-{
-  if (vc->GetMesh()) {
-
-	if (!mUseFalseColors) {
-	  if (vc->GetValid()) 
-		glColor3f(0,1,0);
-	  else
-		glColor3f(0,0,1);
-	}
-	
-	RenderMesh(vc->GetMesh());
-  } else {
-	// render viewcells in the subtree
-	if (!vc->IsLeaf()) {
-	  ViewCellInterior *vci = (ViewCellInterior *) vc;
-
-	  ViewCellContainer::iterator it = vci->mChildren.begin();
-	  for (; it != vci->mChildren.end(); ++it) {
-		RenderViewCell(*it);
-	  }
-	} else {
-	  //	  cerr<<"Empty viewcell mesh\n";
-	}
-  }
+	cerr<<"gl renderer destructor..\n";
+
+	CLEAR_CONTAINER(mOcclusionQueries);
+
+	DeleteVbos();
+
+	if (mData) delete [] mData;
+	if (mIndices) delete [] mIndices;
+
+	glDeleteBuffersARB(1, &mVboId);
+	cerr<<"done."<<endl;
+}
+
+
+void GlRenderer::RenderTriangle(TriangleIntersectable *object)
+{
+	Triangle3 &t = object->GetItem();
+
+	glBegin(GL_TRIANGLES);
+	Vector3 normal = t.GetNormal();
+	glNormal3f(normal.x, normal.y, normal.z);
+	glVertex3f(t.mVertices[0].x, t.mVertices[0].y, t.mVertices[0].z);
+	glVertex3f(t.mVertices[1].x, t.mVertices[1].y, t.mVertices[1].z);
+	glVertex3f(t.mVertices[2].x, t.mVertices[2].y, t.mVertices[2].z);
+	glEnd();
+}
+
+
+void GlRenderer::RenderIntersectable(Intersectable *object)
+{
+	if (!object)
+		return;
+
+	if (object->mRenderedFrame == mCurrentFrame)
+		return;
+
+	object->mRenderedFrame = mCurrentFrame;
+
+	//if (object->Mailed())	return;
+	//object->Mail();
+
+	glPushAttrib(GL_CURRENT_BIT);
+
+	if (mUseFalseColors)
+		SetupFalseColor(object->mId);
+
+	switch (object->Type()) 
+	{
+	case Intersectable::MESH_INSTANCE:
+		RenderMeshInstance((MeshInstance *)object);
+		break;
+	case Intersectable::VIEW_CELL:
+		RenderViewCell(static_cast<ViewCell *>(object));
+		break;
+	case Intersectable::TRANSFORMED_MESH_INSTANCE:
+		RenderTransformedMeshInstance(static_cast<TransformedMeshInstance *>(object));
+		break;
+	case Intersectable::TRIANGLE_INTERSECTABLE:
+		RenderTriangle(static_cast<TriangleIntersectable *>(object));
+		break;
+	case Intersectable::BVH_INTERSECTABLE: 
+		{
+			BvhNode *node = static_cast<BvhNode *>(object);
+
+			if (mRenderBoxes)
+				RenderBox(node->GetBoundingBox());
+			else
+				RenderBvhNode(node);
+			break;
+		}
+	case Intersectable::KD_INTERSECTABLE: 
+		{
+			KdNode *node = (static_cast<KdIntersectable *>(object))->GetItem();
+
+			if (mRenderBoxes)
+				RenderBox(mKdTree->GetBox(node));
+			else
+				RenderKdNode(node);
+			break;
+		}
+
+	default:
+		cerr<<"Rendering this object not yet implemented\n";
+		break;
+	}
+
+	glPopAttrib();
+}
+
+
+void GlRenderer::RenderRays(const VssRayContainer &rays)
+{
+	VssRayContainer::const_iterator it = rays.begin(), it_end = rays.end();
+
+	glBegin(GL_LINES);
+	
+	for (; it != it_end; ++it) 
+	{
+		VssRay *ray = *it;
+		const float importance = log10(1e3*ray->mWeightedPvsContribution)/3.0f;
+		
+		glColor3f(importance, importance, importance);
+		glVertex3fv(&ray->mOrigin.x);
+		glVertex3fv(&ray->mTermination.x);
+	}
+
+	glEnd();
+}
+
+
+void GlRenderer::RenderViewCell(ViewCell *vc)
+{
+	if (vc->GetMesh()) 
+	{
+		if (!mUseFalseColors) 
+		{
+			if (vc->GetValid()) 
+				glColor3f(0,1,0);
+			else
+				glColor3f(0,0,1);
+		}
+
+		RenderMesh(vc->GetMesh());
+	} 
+	else 
+	{
+		// render viewcells in the subtree
+		if (!vc->IsLeaf()) 
+		{
+			ViewCellInterior *vci = (ViewCellInterior *) vc;
+
+			ViewCellContainer::iterator it = vci->mChildren.begin();
+			for (; it != vci->mChildren.end(); ++it) 
+			{
+				RenderViewCell(*it);
+			}
+		} 
+		else 
+		{
+			// cerr<<"Empty viewcell mesh\n";
+		}
+	}
 }
 
@@ -266,16 +268,7 @@
 
 	glPushMatrix();
-/* cout << "\n";
-	for (int i = 0; i < 4; ++ i)
-		for (int j = 0; j < 4; ++ j)
-			cout << m.x[i][j] << " "; cout << "\n"*/
 
 	glMultMatrixf((float *)m.x);
 
-	/*GLfloat dummy[16];
-	glGetFloatv(GL_MODELVIEW_MATRIX, dummy);
-	for (int i = 0; i < 16; ++ i)
-		cout << dummy[i] << " ";
-	cout << endl;*/
 	RenderMesh(mi->GetMesh());
 	
@@ -308,24 +301,24 @@
 
 
-void
-GlRenderer::RenderMesh(Mesh *mesh)
-{
-  int i = 0;
-
-  if (!mUseFalseColors && !mUseForcedColors)
-	  SetupMaterial(mesh->mMaterial);
-  
-  for (i=0; i < mesh->mFaces.size(); i++) {
-	if (mWireFrame)
-	  glBegin(GL_LINE_LOOP);
-	else
-	  glBegin(GL_POLYGON);
-
-	Face *face = mesh->mFaces[i];
-	for (int j = 0; j < face->mVertexIndices.size(); j++) {
-	  glVertex3fv(&mesh->mVertices[face->mVertexIndices[j]].x);
-	}
-	glEnd();
-  }
+void GlRenderer::RenderMesh(Mesh *mesh)
+{
+	int i = 0;
+
+	if (!mUseFalseColors && !mUseForcedColors)
+		SetupMaterial(mesh->mMaterial);
+
+	for (i=0; i < mesh->mFaces.size(); i++) 
+	{
+		if (mWireFrame)
+			glBegin(GL_LINE_LOOP);
+		else
+			glBegin(GL_POLYGON);
+
+		Face *face = mesh->mFaces[i];
+		for (int j = 0; j < face->mVertexIndices.size(); j++) {
+			glVertex3fv(&mesh->mVertices[face->mVertexIndices[j]].x);
+		}
+		glEnd();
+	}
 }
 	
@@ -758,89 +751,89 @@
 									   )
 {
-  // choose a random view point
-  mViewCellsManager->GetViewPoint(mViewPoint);
-  sample.mPosition = mViewPoint;
-  //cout << "viewpoint: " << mViewPoint << endl;
-  
-  // take a render cost sample by rendering a cube
-  Vector3 directions[6];
-  
-  directions[0] = Vector3(1,0,0);
-  directions[1] = Vector3(0,1,0);
-  directions[2] = Vector3(0,0,1);
-  directions[3] = Vector3(-1,0,0);
-  directions[4] = Vector3(0,-1,0);
-  directions[5] = Vector3(0,0,-1);
-  
-  sample.mVisibleObjects = 0;
-  
-  // reset object counters
-  ObjectContainer::const_iterator it, it_end = mObjects.end();
-  
-  for (it = mObjects.begin(); it != it_end; ++ it) 
-	{
-	  (*it)->mCounter = 0;
-	 
-	}
-
-  ++ mFrame;
-  
-  //glCullFace(GL_FRONT);
-  glCullFace(GL_BACK);
-  glDisable(GL_CULL_FACE);
-  
-  
+	// choose a random view point
+	mViewCellsManager->GetViewPoint(mViewPoint);
+	sample.mPosition = mViewPoint;
+	//cout << "viewpoint: " << mViewPoint << endl;
+
+	// take a render cost sample by rendering a cube
+	Vector3 directions[6];
+
+	directions[0] = Vector3(1,0,0);
+	directions[1] = Vector3(0,1,0);
+	directions[2] = Vector3(0,0,1);
+	directions[3] = Vector3(-1,0,0);
+	directions[4] = Vector3(0,-1,0);
+	directions[5] = Vector3(0,0,-1);
+
+	sample.mVisibleObjects = 0;
+
+	// reset object counters
+	ObjectContainer::const_iterator it, it_end = mObjects.end();
+
+	for (it = mObjects.begin(); it != it_end; ++ it) 
+	{
+		(*it)->mCounter = 0;
+
+	}
+
+	++ mFrame;
+
+	//glCullFace(GL_FRONT);
+	glCullFace(GL_BACK);
+	glDisable(GL_CULL_FACE);
+
+
 	// query all 6 directions for a full point sample
-  for (int i = 0; i < 6; ++ i) 
-	{
-	  mViewDirection = directions[i];
-	  SetupCamera();
-	  
-	  glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
-	  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-	  //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);	glDepthMask(GL_TRUE);
-	  glDepthFunc(GL_LESS);
-	  
-	  mUseFalseColors = true;
-	  
-	  // the actual scene rendering fills the depth (for occlusion queries)
-	  // and the frame buffer (for item buffer)
-	  RenderScene();
-	  
-	  
-	  if (0) 
+	for (int i = 0; i < 6; ++ i) 
+	{
+		mViewDirection = directions[i];
+		SetupCamera();
+
+		glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+		//glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);	glDepthMask(GL_TRUE);
+		glDepthFunc(GL_LESS);
+
+		mUseFalseColors = true;
+
+		// the actual scene rendering fills the depth (for occlusion queries)
+		// and the frame buffer (for item buffer)
+		RenderScene();
+
+
+		if (0) 
 		{
-		  char filename[256];
-		  sprintf(filename, "snap/frame-%04d-%d.png", mFrame, i);
-		  //		  QImage im = toImage();
-		  //		  im.save(filename, "PNG");
-		}
-	  
-	  // evaluate the sample
-	  if (useOcclusionQueries) 
+			char filename[256];
+			sprintf(filename, "snap/frame-%04d-%d.png", mFrame, i);
+			//		  QImage im = toImage();
+			//		  im.save(filename, "PNG");
+		}
+
+		// evaluate the sample
+		if (useOcclusionQueries) 
 		{
-		  EvalQueryWithOcclusionQueries();
-		}
-	  else 
+			EvalQueryWithOcclusionQueries();
+		}
+		else 
 		{
-		  EvalQueryWithItemBuffer();
+			EvalQueryWithItemBuffer();
 		}
 	}  
-  
-  // now evaluate the statistics over that sample
-  // currently only the number of visible objects is taken into account
-  sample.Reset();
-  
-  for (it = mObjects.begin(); it != it_end; ++ it) 
-	{
-	  Intersectable *obj = *it;
-	  if (obj->mCounter >= threshold) 
+
+	// now evaluate the statistics over that sample
+	// currently only the number of visible objects is taken into account
+	sample.Reset();
+
+	for (it = mObjects.begin(); it != it_end; ++ it) 
+	{
+		Intersectable *obj = *it;
+		if (obj->mCounter >= threshold) 
 		{
-		  ++ sample.mVisibleObjects;
-		  sample.mVisiblePixels += obj->mCounter;
-		}
-	}
-  
-  //cout << "RS=" << sample.mVisibleObjects << " ";
+			++ sample.mVisibleObjects;
+			sample.mVisiblePixels += obj->mCounter;
+		}
+	}
+
+	//cout << "RS=" << sample.mVisibleObjects << " ";
 }
 
@@ -856,5 +849,5 @@
 #endif
 #endif
-	
+
 }
 
@@ -867,36 +860,36 @@
 								   )
 {
-  MakeCurrent();
-
-  if (mPixelBuffer == NULL)
-	  mPixelBuffer = new unsigned int[GetWidth()*GetHeight()];
-  
-  // using 90 degree projection to capture 360 view with 6 samples
-  SetupProjection(GetHeight(), GetHeight(), 90.0f);
-
-  //samples.resize(numSamples);
-  halton.Reset();
-  
-  // the number of queries queried in batch mode
-  const int numQ = 500;
-
-  //const int numQ = (int)mObjects.size();
-  if (useOcclusionQueries)
-  {
-	  cout << "\ngenerating " << numQ << " queries ... ";
-	  OcclusionQuery::GenQueries(mOcclusionQueries, numQ);
-	  cout << "finished" << endl;
-  }
-
-  // sampling queries 
-  for (int i = 0; i < numSamples; ++ i)
-  {
-	  cout << ".";
-	  EvalRenderCostSample(samples[i], useOcclusionQueries, threshold);
-  }
-
-  DoneCurrent();
-}
-  
+	MakeCurrent();
+
+	if (mPixelBuffer == NULL)
+		mPixelBuffer = new unsigned int[GetWidth()*GetHeight()];
+
+	// using 90 degree projection to capture 360 view with 6 samples
+	SetupProjection(GetHeight(), GetHeight(), 90.0f);
+
+	//samples.resize(numSamples);
+	halton.Reset();
+
+	// the number of queries queried in batch mode
+	const int numQ = 500;
+
+	//const int numQ = (int)mObjects.size();
+	if (useOcclusionQueries)
+	{
+		cout << "\ngenerating " << numQ << " queries ... ";
+		OcclusionQuery::GenQueries(mOcclusionQueries, numQ);
+		cout << "finished" << endl;
+	}
+
+	// sampling queries 
+	for (int i = 0; i < numSamples; ++ i)
+	{
+		cout << ".";
+		EvalRenderCostSample(samples[i], useOcclusionQueries, threshold);
+	}
+
+	DoneCurrent();
+}
+
 
 
@@ -1500,63 +1493,63 @@
 GlRenderer::ValidViewPoint()
 {
-   //cout<<"VV4 ";
+	//cout<<"VV4 ";
 	if (!mDetectEmptyViewSpace)
 		return true;
 	//cout << "vp: " << mViewPoint << " dir: " << mViewDirection << endl;
 
-  OcclusionQuery *query = mOcclusionQueries[0];
-
-  // now check whether any backfacing polygon would pass the depth test
-  SetupCamera();
-  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-  glEnable( GL_CULL_FACE );
-  glCullFace(GL_BACK);
-  
-  //cout<<"VV1 ";
-  RenderScene();
-  
-  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-  glDepthMask(GL_FALSE);
-  glDisable( GL_CULL_FACE );
-  
-  query->BeginQuery();
-  
-  //  cout<<"VV2 ";
-  RenderScene();
-  //  cout<<"VV3 ";
-  
-  query->EndQuery();
-  
-  // at this point, if possible, go and do some other computation
-  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-  glDepthMask(GL_TRUE);
-  glEnable( GL_CULL_FACE );
-
-  //  int wait = 0;
-  //  while (!query.ResultAvailable()) {
-  //	wait++;
-  //  }
-  
-  // reenable other state
-  unsigned int pixelCount = query->GetQueryResult();
-  //  cout<<"VV4 ";
-  
-	  //cout<<"count: " << pixelCount<<endl;
-  
-  if (pixelCount > 0)
-  {
-	return false; // backfacing polygon found -> not a valid viewspace sample
-  }
-  return true;
-}
-
-float
-GlRenderer::GetPixelError(int &pvsSize)
+	OcclusionQuery *query = mOcclusionQueries[0];
+
+	// now check whether any backfacing polygon would pass the depth test
+	SetupCamera();
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+	glEnable( GL_CULL_FACE );
+	glCullFace(GL_BACK);
+
+	//cout<<"VV1 ";
+	RenderScene();
+
+	glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+	glDepthMask(GL_FALSE);
+	glDisable( GL_CULL_FACE );
+
+	query->BeginQuery();
+
+	//  cout<<"VV2 ";
+	RenderScene();
+	//  cout<<"VV3 ";
+
+	query->EndQuery();
+
+	// at this point, if possible, go and do some other computation
+	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+	glDepthMask(GL_TRUE);
+	glEnable( GL_CULL_FACE );
+
+	//  int wait = 0;
+	//  while (!query.ResultAvailable()) {
+	//	wait++;
+	//  }
+
+	// reenable other state
+	unsigned int pixelCount = query->GetQueryResult();
+	//  cout<<"VV4 ";
+
+	//cout<<"count: " << pixelCount<<endl;
+
+	if (pixelCount > 0)
+	{
+		return false; // backfacing polygon found -> not a valid viewspace sample
+	}
+	return true;
+}
+
+
+float GlRenderer::GetPixelError(int &pvsSize)
 {
   return -1.0f;
 }
 
-void
-GlRenderer::RenderViewPoint()
+
+void GlRenderer::RenderViewPoint()
 {
 	mWireFrame = true;
