Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 3260)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.h	(revision 3293)
@@ -81,5 +81,8 @@
 	Texcoord2 *mTexCoords;
 
+	unsigned int *mIndices;
+
 	unsigned int mVboId;
+	unsigned int mVboId2;
 
 	int mNumVertices;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp	(revision 3284)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp	(revision 3293)
@@ -31,5 +31,7 @@
 mTangents(tangents),
 mNumVertices(numVertices), 
-mVboId(-1)
+mVboId(-1),
+mVboId2(-1),
+mIndices(NULL)
 {
 	mHasTexture = (mTexCoords != NULL);
@@ -37,4 +39,11 @@
 
 	Prepare();
+
+	mIndices = new unsigned int[mNumVertices];
+
+	for (int i = 0; i < mNumVertices; ++ i)
+	{
+		mIndices[i] = i;
+	}
 
 	if (delData)
@@ -54,4 +63,5 @@
 	DEL_ARRAY_PTR(mTexCoords);
 	DEL_ARRAY_PTR(mTangents);
+	DEL_ARRAY_PTR(mIndices);
 
 	// delete vbo
@@ -87,6 +97,5 @@
 
 			float dotProd = DotProd(tangent, normal);
-			//tangent -= normal * dotProd;tangent = Normalize(tangent);
-
+			//tangent -= normal * dotProd; tangent = Normalize(tangent);
 			//mTangents[i] = tangent;
 			mTangents[i] = tangent * 0.5f + Vector3(0.5f);
@@ -94,5 +103,7 @@
 
 		for (int i = 0; i < mNumVertices; ++ i)
+		{
 			((Vector3 *)data)[mNumVertices * 2 + i] = mTangents[i];
+		}
 
 		currentPData += mNumVertices * 3;
@@ -102,5 +113,7 @@
 	{
 		for (int i = 0; i < mNumVertices; ++ i)
+		{
 			((Texcoord2 *)currentPData)[i] = mTexCoords[i];
+		}
 	}
 
@@ -120,21 +133,5 @@
 	if (mTangents)
 	{
-		//cout << "dotprods: " << endl;
-
-		/*for (int i = 0; i < 100; ++ i)
-		{
-			//cout << mTangents[i] << " " << mNormals[i] << " " << DotProd(Normalize(mTangents[i]), Normalize(mNormals[i])) << endl;
-			float d = fabs(DotProd(Normalize(mTangents[i]), Normalize(mNormals[i])));
-			if (d > 0.01) cout << d << " ";
-			//cout << d << " ";
-		}
-		cout << endl;
-		*/
-	
-		for (int i = 0; i < 50; ++ i)
-		{
-			cout << mTexCoords[i].first << "," << mTexCoords[i].second << " ";
-		}
-
+		// hack: use color pointer to store tangents
 		glColorPointer(3, GL_FLOAT, 0, (char *)NULL + currentPVbo);
 		currentPVbo += mNumVertices * sizeof(Vector3);
@@ -151,4 +148,16 @@
 	glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
 
+	glGenBuffersARB(1, &mVboId2);
+	
+	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2);
+	glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mNumVertices * sizeof(unsigned int), 
+		            mIndices, GL_STATIC_DRAW_ARB);
+
+	int bufferSize;
+	glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &bufferSize);
+	// cout << "Index Array in VBO: " << bufferSize << " bytes\n";
+
+	glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+
 	// data handled by graphics driver from now on
 	delete [] data;
@@ -166,7 +175,7 @@
 	{
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId);
-		
+		//glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2);
+
 		int currentPointer;
-
 		glNormalPointer(GL_FLOAT, 0, (char *)NULL + mNumVertices * sizeof(Vector3));
 
@@ -182,20 +191,26 @@
 		}
 		else
+		{
 			currentPointer = mNumVertices * 2 * sizeof(Vector3);
+		}
 
 		if (mHasTexture)
+		{
 			glTexCoordPointer(2, GL_FLOAT, 0, (char *)NULL + currentPointer);
+		}
 
 		glVertexPointer(3, GL_FLOAT, 0, (char *)NULL);	
-
+		/// update state
 		state->SetCurrentVboId(mVboId);
-
-	}
-
-	// don't render first degenerate index
+	}
+
 	glDrawArrays(GL_TRIANGLES, 0, mNumVertices);
-
-	if (mHasTangents)
-		glDisableClientState(GL_COLOR_ARRAY);
+	//glDrawElements(GL_TRIANGLES, mNumVertices, GL_UNSIGNED_INT, mIndices);
+	//glDrawElements(GL_TRIANGLES, mNumVertices, GL_UNSIGNED_INT, 0); 
+
+	//glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+	//glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+
+	if (mHasTangents) glDisableClientState(GL_COLOR_ARRAY);
 }
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3291)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp	(revision 3293)
@@ -658,4 +658,6 @@
 	{
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId);
+		//glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2);
+
 		// set the vertex pointer to the vertex buffer
 		glVertexPointer(3, GL_FLOAT, 0, (char *)NULL);	
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3292)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj	(revision 3293)
@@ -156,5 +156,5 @@
 				IgnoreAllDefaultLibraries="false"
 				IgnoreDefaultLibraryNames="LIBCMT"
-				GenerateDebugInformation="false"
+				GenerateDebugInformation="true"
 				SubSystem="1"
 				LargeAddressAware="2"
