Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h	(revision 2844)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h	(revision 2847)
@@ -3,4 +3,5 @@
 
 #include "common.h"
+#include "Vector3.h"
 
 
@@ -21,4 +22,12 @@
 	/// shapes belonging to this LOD level
 	ShapeContainer mShapes;
+
+
+	/** Has to be called each frame in order to use proper LOD level.
+	*/
+	static void InitFrame(const Vector3 &viewPoint);
+
+	static int sFrameId;
+	static Vector3 sViewPoint;
 };
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 2844)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.h	(revision 2847)
@@ -74,7 +74,5 @@
 	////////////////
 
-	/** Internally updates current lod level.
-	*/
-	void UpdateLODs(Camera *cam);
+	
 	/** Returns shapes of specified lod level
 	*/
@@ -90,6 +88,17 @@
 	int GetNumLODLevels() const { return (int)mLODLevels.size(); }
 
+	/** Returns transformed center point of this shape.
+	*/
+	Vector3 GetCenter() const;
+
 protected:
 
+	/** Internally updates current lod level.
+	*/
+	void UpdateLODs(const Vector3 &viewPoint);
+
+
+
+	/// the bounding box
 	AxisAlignedBox3 mBox;
 	/// transform matrix 
@@ -103,4 +112,9 @@
 
 	int mCurrentLODLevel;
+
+	/// which frame the lod info was last updated
+	int mLODLastUpdated;
+
+	Vector3 mCenter;
 };
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 2844)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.cpp	(revision 2847)
@@ -109,6 +109,5 @@
 		{
 			SceneEntity *ent = entities[i];
-			ent->UpdateLODs(mCamera);
-			
+		
 			mStats.mNumRenderedTriangles += ent->CountNumTriangles();
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp	(revision 2844)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.cpp	(revision 2847)
@@ -16,4 +16,5 @@
 mRenderQueueBucket(NULL)
 {
+	mCenter = GetBoundingBox().Center();
 }
 
@@ -30,5 +31,4 @@
 	mGeometry->Render(state);
 	mParent->GetTransform()->Unload(state);
-
 }
 
@@ -63,3 +63,14 @@
 }
 
+
+Vector3 Shape::GetCenter() const
+{
+	Matrix4x4 *mat = mParent->GetTransform()->GetMatrix();
+
+	if (!mat) return mCenter;
+
+	return (*mat) * mCenter;
 }
+
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 2845)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.cpp	(revision 2847)
@@ -144,5 +144,5 @@
 		// assume that the incoming nodes are ordered by distance 
 		// => set min dist on first incoming node
-		const Vector3 v = shape->GetTransformedBoundingBox().Center() - mCamera->GetPosition();
+		const Vector3 v = shape->GetCenter() - mCamera->GetPosition();
 		
 		const float dist = SqrMagnitude(v);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h	(revision 2842)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Shape.h	(revision 2847)
@@ -6,4 +6,5 @@
 #include <Cg/cgGL.h>
 #include "common.h"
+#include "Vector3.h"
 
 
@@ -16,4 +17,5 @@
 class RenderState;
 class AxisAlignedBox3;
+class Vector3;
 
 struct RenderQueueBucket;
@@ -53,6 +55,12 @@
 
 	inline Material *GetMaterial() const  { return mMaterial; }
+	/** Returns transformed center point of this shape.
+	*/
+	Vector3 GetCenter() const;
+
 
 protected:
+
+	Vector3 mCenter;
 
 	Geometry *mGeometry;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.cpp	(revision 2847)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.cpp	(revision 2847)
@@ -0,0 +1,19 @@
+#include "LODInfo.h"
+#include "Vector3.h"
+
+
+namespace CHCDemoEngine 
+{
+
+int LODLevel::sFrameId = 0;
+Vector3 LODLevel::sViewPoint(0.0f, 0.0f, 0.0f);
+
+
+void LODLevel::InitFrame(const Vector3 &viewPoint)
+{
+	sViewPoint = viewPoint;
+	++ sFrameId;
+}
+
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2844)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp	(revision 2847)
@@ -20,5 +20,5 @@
 
 SceneEntity::SceneEntity(Transform3 *trafo): 
-mTransform(trafo), mCurrentLODLevel(0)
+mTransform(trafo), mCurrentLODLevel(0), mLODLastUpdated(-1)
 {
 	mBox.Initialize();
@@ -31,13 +31,13 @@
 
 
-void SceneEntity::UpdateLODs(Camera *cam)
+void SceneEntity::UpdateLODs(const Vector3 &viewPoint)
 {
-	const Vector3 pos = GetTransformedBoundingBox().Center();
+	const Vector3 pos = GetCenter();
 
-	const float distance = SqrDistance(pos, cam->GetPosition());
+	const float distance = SqrDistance(pos, viewPoint);
 
 	mCurrentLODLevel = 0;
 
-	int l = (int)mLODLevels.size();
+	const int l = (int)mLODLevels.size();
 
 	for (int i = 0; i < l; ++ i)
@@ -60,4 +60,10 @@
 									 ShapeContainer::iterator &end)
 {
+	if (mLODLastUpdated != LODLevel::sFrameId)
+	{
+		mLODLastUpdated = LODLevel::sFrameId;
+		UpdateLODs(LODLevel::sViewPoint);
+	}
+
 	start = mLODLevels[mCurrentLODLevel]->mShapes.begin(); 
 	end = mLODLevels[mCurrentLODLevel]->mShapes.end();
@@ -80,14 +86,6 @@
 	ShapeContainer::iterator sit, sit_end;
 
-	/*if (mShapes.size() > 8)
-	{
-		sit = mShapes.begin() + 6;
-		sit_end = mShapes.begin() + 6;
-	}
-	else*/
-		GetCurrentLODLevel(sit, sit_end);
+	GetCurrentLODLevel(sit, sit_end);
 
-	//if (mShapes.size() > 1)
-		//mShapes[0]->Render(state);
 	for (; sit != sit_end; ++ sit)
 	{
@@ -101,4 +99,6 @@
 	mShapes.push_back(shape);
 	mBox.Include(shape->GetBoundingBox());
+
+	mCenter = mBox.Center();
 }
 
@@ -163,3 +163,15 @@
 }
 
+
+Vector3 SceneEntity::GetCenter() const
+{
+	Matrix4x4 *mat = mTransform->GetMatrix();
+
+	if (!mat)
+		return mCenter;
+
+	return (*mat) * mCenter;
 }
+
+
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2846)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 2847)
@@ -456,11 +456,14 @@
 	// create noise texture for ssao
 	CreateNoiseTex2D();
+
 	// init render traverser
 	ResetTraverser();
 
-
 	visualization = new Visualization(bvh, camera, NULL, &state);
 
 	sceneQuery = new SceneQuery(bvh->GetBox(), traverser);
+
+	// frame time is restarted every frame
+	frameTimer.Start();
 
 
@@ -1099,10 +1102,4 @@
 void Display() 
 {	
-	glFlush();
-	elapsedTime = frameTimer.Elapsedms();
-
-	// take time from last frame
-	frameTimer.Start();
-
 	Vector3 oldPos = camera->GetPosition();
 
@@ -1193,4 +1190,7 @@
 		
 
+	LODLevel::InitFrame(camera->GetPosition());
+
+
 	// bring eye modelview matrix up-to-date
 	SetupEyeView();
@@ -1272,4 +1272,9 @@
 		if (visMode) DisplayVisualization();
 	}
+
+	glFlush();
+
+	const bool restart = true;
+	elapsedTime = frameTimer.Elapsedms(restart);
 
 	DisplayStats();
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt	(revision 2806)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt	(revision 2847)
@@ -81,3 +81,5 @@
 The project is separated into one section containing supportive code (utils), the traversal algorithms (traversal), and the basic engine classes like Camera, Geometry, Material, or RenderState (rendering). 
 
+the tool uses some free 3rd party libraries, like DevIL for the image processing, and glfont2 for the HUD (http://students.cs.byu.edu/~bfish/glfont2.php, many thanks to Brad Fish for fast antialiased text). Also thanks to Alexander Kusternig for providing me his code for the SSAO shader.
+
 If you find any problem with the code or have any comments, please feel free to ask us at any time.
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2840)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2847)
@@ -613,4 +613,8 @@
 				</File>
 				<File
+					RelativePath=".\src\LODInfo.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\src\Material.cpp"
 					>
