Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp	(revision 3126)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp	(revision 3127)
@@ -15,4 +15,5 @@
 #endif
 
+using namespace std;
 
 namespace CHCDemoEngine 
@@ -66,5 +67,4 @@
 
 	if (mTexCoords)	dataSize += mNumVertices * 2;
-	
 	if (mTangents) dataSize += mNumVertices * 3;
 
@@ -82,5 +82,8 @@
 	{
 		for (int i = 0; i < mNumVertices; ++ i)
-			((Vector3 *)data)[mNumVertices * 3 + i] = mTangents[i];
+			((Vector3 *)data)[mNumVertices * 2 + i] = mTangents[i];
+
+		for (int i = 0; i < 3; ++ i)
+			cout << ((Vector3 *)data)[mNumVertices * 2 + i] << " ";
 
 		currentPData += mNumVertices * 3;
@@ -129,20 +132,37 @@
 void Geometry::Render(RenderState *state)
 {
+	if (mHasTangents)
+		glEnableClientState(GL_COLOR_ARRAY);
+
 	if (state->GetCurrentVboId() != mVboId)
 	{
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId);
 		
-		if (mHasTexture)
-			glTexCoordPointer(2, GL_FLOAT, 0, (char *)NULL + 2 * mNumVertices * sizeof(Vector3));
+		int currentPointer;
 
 		glNormalPointer(GL_FLOAT, 0, (char *)NULL + mNumVertices * sizeof(Vector3));
+
+		if (mHasTangents)
+		{
+			glColorPointer(3, GL_FLOAT, 0, (char *)NULL + mNumVertices * sizeof(Vector3));
+			currentPointer = mNumVertices * 3 * sizeof(Vector3);
+		}
+		else
+			currentPointer = mNumVertices * 2 * sizeof(Vector3);
+
+		if (mHasTexture)
+			glTexCoordPointer(2, GL_FLOAT, 0, (char *)NULL + currentPointer);
 
 		glVertexPointer(3, GL_FLOAT, 0, (char *)NULL);	
 
 		state->SetCurrentVboId(mVboId);
+
 	}
 
 	// don't render first degenerate index
 	glDrawArrays(GL_TRIANGLES, 0, mNumVertices);
+
+	if (mHasTangents)
+		glDisableClientState(GL_COLOR_ARRAY);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp	(revision 3126)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp	(revision 3127)
@@ -130,4 +130,10 @@
 		static Technique queryTech = GetQueryTechnique();
 		SetState(&queryTech);
+
+		glDisableClientState(GL_NORMAL_ARRAY);
+	}
+	else
+	{
+		glEnableClientState(GL_NORMAL_ARRAY);
 	}
 
@@ -219,7 +225,5 @@
 	{
 		mTexturesEnabled = false;
-
-		//if (!tech->GetFragmentProgram())
-			glDisable(GL_TEXTURE_2D);
+		glDisable(GL_TEXTURE_2D);
 
 		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -229,7 +233,5 @@
 		mTexturesEnabled = true;
 
-		//if (!tech->GetFragmentProgram())
-			glEnable(GL_TEXTURE_2D);
-
+		glEnable(GL_TEXTURE_2D);
 		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 	}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3126)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3127)
@@ -39,4 +39,5 @@
 ResourceManager::ResourceManager()
 { 
+	mUseNormalMapping = false;
 }
 
@@ -289,4 +290,7 @@
 	static ShaderProgram *sDefaultVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultVertexMrt");
 
+	static ShaderProgram *sNormalMappingVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingVertexMrt");
+	static ShaderProgram *sNormalMappingFragmentProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("normalMappingFragmentMrt");
+
 	Technique *deferred = new Technique(*tech);
 
@@ -343,4 +347,16 @@
 	str.read(reinterpret_cast<char *>(normals), sizeof(Vector3) * vertexCount);
 
+	Vector3 *tangents;
+
+	if (mUseNormalMapping)
+	{
+		tangents = new Vector3[vertexCount];
+		str.read(reinterpret_cast<char *>(tangents), sizeof(Vector3) * vertexCount);
+	}
+	else
+	{
+		tangents = NULL;
+	}
+
 	int texCoordCount;
 	str.read(reinterpret_cast<char *>(&texCoordCount), sizeof(int));
@@ -356,6 +372,6 @@
 	}
 
-	return new Geometry(vertices, normals, texcoords, vertexCount, true, NULL);
-	//return new Geometry(vertices, normals, texcoords, vertexCount, false);
+	const bool delGeometry = false;
+	return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, tangents);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3125)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3127)
@@ -1508,5 +1508,5 @@
 	mRoot->mLast = (int)mGeometrySize - 1;
 
-	cout<<"f: " << mRoot->mFirst<< " l: " <<mRoot->mLast << endl;
+	//cout<<"f: " << mRoot->mFirst<< " l: " <<mRoot->mLast << endl;
 	// add static root on left subtree
 	mRoot->mFront = mStaticRoot;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 3070)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h	(revision 3127)
@@ -58,4 +58,6 @@
 
 
+	bool mUseNormalMapping;
+
 protected:
 	
@@ -76,4 +78,5 @@
 	Geometry *LoadGeometry(igzstream &str);
 
+
 	std::map<int, Texture *> mTextureTable;
 	std::map<int, Material *> mMaterialTable;
@@ -90,5 +93,5 @@
 	TransformContainer mTrafos;
 	ShapeContainer mShapes;
-	//LODContainer mLODs;
+	
 	/// the scene entities
 	SceneEntityContainer mSceneEntities;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3125)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3127)
@@ -471,6 +471,11 @@
 	//-- load some dynamic stuff
 
-	//LoadModel("fisch.dem", dynamicObjects);
-	LoadModel("hbuddha.dem", dynamicObjects);
+	resourceManager->mUseNormalMapping = true;
+	//resourceManager->mUseNormalMapping = false;
+
+	LoadModel("fisch.dem", dynamicObjects);
+	
+	resourceManager->mUseNormalMapping = false;
+	//LoadModel("hbuddha.dem", dynamicObjects);
 	buddha = dynamicObjects.back();
 	
@@ -1996,4 +2001,5 @@
 	}
 
+
 	/////////////////
 	//-- reset gl renderState before the final visible objects pass
@@ -2115,6 +2121,7 @@
 	const string filename = string(model_path + model);
 
+	cout << "\nloading model " << filename << endl;
 	if (resourceManager->Load(filename, entities))
-		cout << "model " << filename << " loaded" << endl;
+		cout << "model " << filename << " successfully loaded" << endl;
 	else
 	{
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp	(revision 3120)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.cpp	(revision 3127)
@@ -19,4 +19,5 @@
 		delete [] mGeometry[i]->mVertices;
 		delete [] mGeometry[i]->mNormals;
+		delete [] mGeometry[i]->mTangents;
 		delete [] mGeometry[i]->mTexcoords;
 
@@ -83,4 +84,5 @@
 	geom->mVertices = new SimpleVec[numElements];
 	geom->mNormals = new SimpleVec[numElements];
+	geom->mTangents = new SimpleVec[numElements];
 	geom->mTexcoords = new Texcoord[numElements];
 
@@ -105,4 +107,5 @@
 		geom->mNormals[line] = normal;
 		geom->mTexcoords[line] = tex;
+		geom->mTangents[line] = tangent;
 
 		++ line;
@@ -125,4 +128,5 @@
 	str.write(reinterpret_cast<char *>(geom->mVertices), sizeof(SimpleVec) * vertexCount);
 	str.write(reinterpret_cast<char *>(geom->mNormals), sizeof(SimpleVec) * vertexCount);
+	str.write(reinterpret_cast<char *>(geom->mTangents), sizeof(SimpleVec) * vertexCount);
 
 	int texCoordCount = geom->mTexcoordCount;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.h	(revision 3119)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/VboFormatConverter/VboFormatConverter.h	(revision 3127)
@@ -32,4 +32,5 @@
 		SimpleVec *mVertices;
 		SimpleVec *mNormals;
+		SimpleVec *mTangents;
 		Texcoord *mTexcoords;
 
