Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2951)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 2953)
@@ -19,5 +19,7 @@
 
 public:
-	/** Constructor taking an array of triangles.
+	/** Constructs a geometry from the given data. 
+		The vertices are interpreted as triangles.
+
 		If delData is true, the vertex / normal / texture is deleted when
 		after it was transferred into a vbo
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 2951)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 2953)
@@ -149,7 +149,4 @@
 	mMaxVisibleDistance = .0f;
 
-	glEnableClientState(GL_VERTEX_ARRAY);
-	if (!mUseDepthPass) glEnableClientState(GL_NORMAL_ARRAY);
-
 	++ mFrameId;
 
@@ -158,4 +155,5 @@
 	mStats.Reset();
 	mQueryHandler.ResetQueries();
+
 	// add root node to queue
 	EnqueueNode(mBvh->GetRoot());
@@ -172,9 +170,4 @@
 	// reset the render state
 	mRenderState->Reset();
-
-	glDisableClientState(GL_VERTEX_ARRAY);
-	glDisableClientState(GL_NORMAL_ARRAY);
-
-	//cout << "rq overhead: " << 1e3f * mRenderQueue->rTimer.TotalTime() << " ms" << endl;
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2889)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 2953)
@@ -69,5 +69,4 @@
 		str.read(reinterpret_cast<char *>(&dist), sizeof(float));
 
-		//if (i>=3) dist=2e20;
 		int numShapes;
 		str.read(reinterpret_cast<char *>(&numShapes), sizeof(int));
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp	(revision 2951)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.cpp	(revision 2953)
@@ -21,6 +21,6 @@
 	box.Triangulate(triangles);
 
-	Vector3 *vertices = new Vector3[12];
-	Vector3 *normals = new Vector3[12];
+	Vector3 *vertices = new Vector3[36];
+	Vector3 *normals = new Vector3[36];
 
 	for (size_t i = 0; i < triangles.size(); ++ i)
@@ -39,9 +39,15 @@
 	}
 
+	cout<<"number of triangles in box: " << triangles.size() << endl;
 
-	Geometry *geom = new Geometry(vertices, normals, NULL, 12, true);
+	Geometry *geom = new Geometry(vertices, normals, NULL, 36, false);
 
 	Shape *shape = new Shape(geom, mat, ent);
 	ent->AddShape(shape);
+
+	LODLevel *lodLevel = new LODLevel(0);
+
+	lodLevel->AddShape(shape);
+	ent->AddLODLevel(lodLevel);
 
 	return ent;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2899)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp	(revision 2953)
@@ -179,5 +179,11 @@
 	renderer->SetCamera(orthoCam);
 
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glEnableClientState(GL_NORMAL_ARRAY);
+
 	renderer->RenderScene();
+
+	glDisableClientState(GL_VERTEX_ARRAY);
+	glDisableClientState(GL_NORMAL_ARRAY);
 
 	renderer->SetCamera(oldCam);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.h	(revision 2946)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntityConverter.h	(revision 2953)
@@ -22,7 +22,7 @@
 	/** Creates a scene entity.
 	*/
-	SceneEntityConverter();
+	SceneEntityConverter() {};
 	
-	~SceneEntityConverter();
+	//~SceneEntityConverter();
 
 	/** Converts this box to a scene entity
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2952)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp	(revision 2953)
@@ -700,5 +700,4 @@
 
 
-
 	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2952)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2953)
@@ -36,4 +36,5 @@
 #include "ShadowMapping.h"
 #include "Light.h"
+#include "SceneEntityConverter.h"
 
 
@@ -187,5 +188,7 @@
 DeferredRenderer *ssaoShader = NULL;
 
-
+SceneEntity *cube = NULL;
+
+bool altKeyPressed = false;
 
 // function forward declarations
@@ -627,4 +630,12 @@
 	else
 		cout << "successfully created font" << endl;
+
+	Vector3 cubeCenter(470.398f, 240.364f, 182.5f);
+
+	AxisAlignedBox3 box(cubeCenter - Vector3(2.0f), cubeCenter + Vector3(2.0f));
+
+	Material *mat = new Material(RgbaColor(1, 0.4, 0.4, 0));
+	Transform3 *tf = new Transform3(NULL);
+	cube = SceneEntityConverter().ConvertBox(box, mat, tf);
 }
 
@@ -918,4 +929,6 @@
 		renderType = RenderState::FIXED;
 
+	glEnableClientState(GL_VERTEX_ARRAY);
+
 
 	// render with the specified method (forward rendering, forward + depth, deferred)
@@ -934,4 +947,6 @@
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
+		glEnableClientState(GL_NORMAL_ARRAY);
+
 		break;
 
@@ -957,4 +972,5 @@
 		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
 
+
 		break;
 
@@ -974,4 +990,5 @@
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+
 
 		break;
@@ -990,7 +1007,8 @@
 		glDrawBuffers(3, mrt);
 
-		break;
-	}
-
+		glEnableClientState(GL_NORMAL_ARRAY);
+
+		break;
+	}
 
 	glDepthFunc(GL_LESS);
@@ -1023,4 +1041,7 @@
 	else
 	{
+		//glEnable(GL_CULL_FACE);
+		//cube->Render(&state);
+
 		// actually render the scene geometry using the specified algorithm
 		traverser->RenderScene();
@@ -1030,7 +1051,4 @@
 	/////////
 	//-- do the rest of the rendering
-
-	glEnableClientState(GL_VERTEX_ARRAY);
-	glEnableClientState(GL_NORMAL_ARRAY);
 
 	
@@ -1282,8 +1300,10 @@
 		downKeyPressed = false;
 		break;
+	case GLUT_ACTIVE_ALT:
+		altKeyPressed = false;
+		break;
 	default:
 		return;
 	}
-	//glutPostRedisplay();
 }
 
@@ -1385,4 +1405,7 @@
 		}
 		break;
+	case GLUT_ACTIVE_ALT:
+		altKeyPressed = true;
+		break;
 	default:
 		return;
@@ -1420,4 +1443,6 @@
 void Mouse(int button, int state, int x, int y) 
 {
+	int specialKey = glutGetModifiers();
+
 	if ((button == GLUT_LEFT_BUTTON) && (state == GLUT_DOWN))
 	{
@@ -1829,9 +1854,14 @@
 			int i = 4;
 
-			sprintf(msg[i ++], "rendered: %s of %s objects, %s of %s triangles", 
-				objStr.c_str(), totalObjStr.c_str(), triStr.c_str(), totalTriStr.c_str()); 
-
-			//sprintf(msg[i ++], "rendered: %6d of %6d nodes, %s of %s triangles", 
-			//	renderedNodes, bvh->GetNumVirtualNodes(), triStr.c_str(), totalTriStr.c_str()); 
+			if (0)
+			{
+				sprintf(msg[i ++], "rendered: %s of %s objects, %s of %s triangles", 
+					objStr.c_str(), totalObjStr.c_str(), triStr.c_str(), totalTriStr.c_str()); 
+			}
+			else
+			{
+				sprintf(msg[i ++], "rendered: %6d of %6d nodes, %s of %s triangles", 
+					renderedNodes, bvh->GetNumVirtualNodes(), triStr.c_str(), totalTriStr.c_str()); 
+			}
 
 			sprintf(msg[i ++], "traversed: %5d, frustum culled: %5d, query culled: %5d",
@@ -1888,8 +1918,5 @@
 			float minVisibleDist = min(camera->GetFar(), traverser->GetMaxVisibleDistance());
 			RenderShadowMap(minVisibleDist);
-			//cout << "far: " << camera->GetFar() << " min: " << traverser->GetMaxVisibleDistance() << endl;
 		}
-		glEnableClientState(GL_VERTEX_ARRAY);
-		glEnableClientState(GL_NORMAL_ARRAY);
 
 		glDisable(GL_LIGHTING);
@@ -1910,4 +1937,7 @@
 	}
 
+
+	glEnableClientState(GL_NORMAL_ARRAY);
+
 	// draw all objects that have exactly the same depth as the current sample
 	glDepthFunc(GL_LEQUAL);
@@ -1953,4 +1983,6 @@
 	cgGLDisableProfile(RenderState::sCgFragmentProfile);
 	cgGLDisableProfile(RenderState::sCgVertexProfile);
+
+	glDisableClientState(GL_NORMAL_ARRAY);
 
 	state.SetRenderType(RenderState::DEPTH_PASS);
@@ -1971,4 +2003,6 @@
 	state.SetUseAlphaToCoverage(true);
 
+	glEnableClientState(GL_NORMAL_ARRAY);
+
 	// change back state
 	BvhNode::SetCurrentState(0);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2944)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Matrix4x4.cpp	(revision 2953)
@@ -580,6 +580,5 @@
 {
 	Vector3 ret;
-	float denom;
-
+	
 	ret.x = v.x * x[0][0] + v.y * x[1][0] + v.z * x[2][0] + h * x[3][0];
 	ret.y = v.x * x[0][1] + v.y * x[1][1] + v.z * x[2][1] + h * x[3][1];
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/MotionPath.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/MotionPath.cpp	(revision 2951)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/MotionPath.cpp	(revision 2953)
@@ -19,4 +19,5 @@
 Vector3 MotionPath::GetCurrentPosition() const
 {
+	return mT * mVertices[mCurrentVertexIdx] + (1.0f - mT) * mVertices[(mCurrentVertexIdx + 1) % mVertices.size()];
 }
 
@@ -24,4 +25,5 @@
 Vector3 MotionPath::GetCurrentDirection() const
 {
+	return Vector3(1, 0, 0);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 2952)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 2953)
@@ -11,5 +11,6 @@
 camPosition=483.398f 242.364f 186.078f
 camDirection=1 0 0
-lightDir=-0.8f 1.0f -0.7f
+#lightDirection=-0.8f 1.0f -0.7f
+lightDirection=0.2f -1.0f -.5f
 useFullScreen=0
 useLODs=1
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2951)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2953)
@@ -276,4 +276,12 @@
 			</File>
 			<File
+				RelativePath=".\src\ObjConverter.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\src\ObjConverter.h"
+				>
+			</File>
+			<File
 				RelativePath=".\src\PerformanceGraph.cpp"
 				>
