Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3370)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h	(revision 3371)
@@ -8,12 +8,12 @@
 //#define NUM_PRECOMPUTED_SAMPLES 8124
 #define NUM_PRECOMPUTED_SAMPLES 4096
-#define NUM_PRECOMPUTED_SAMPLES 64
+//#define NUM_PRECOMPUTED_SAMPLES 1024
 
 //#define NUM_SAMPLES 16
-//#define NUM_SAMPLES 24
+#define NUM_SAMPLES 16
 //#define NUM_SAMPLES 32
-#define NUM_SAMPLES 64
+//#define NUM_SAMPLES 64
 
-#define MIN_SAMPLES 64
+#define MIN_SAMPLES 16
 //#define MIN_SAMPLES 48
 
@@ -66,5 +66,5 @@
 #define NUM_DOF_TABS 16
 
-#define USE_GTX
+//#define USE_GTX
 
 #define SSAO_FILTER_RADIUS 5
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3370)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 3371)
@@ -487,6 +487,6 @@
 		float2 offset;
 
-		//const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy;
-		const float2 ssaoOffset = dummySamples[i];
+		const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy;
+		//const float2 ssaoOffset = dummySamples[i];
 
 		////////////////////
@@ -494,5 +494,5 @@
 		//-- (affects performance for some reason!)
 
-		if (0)//!USE_OPTIMIZATION ||
+		if (1)//!USE_OPTIMIZATION ||
 			//(convergence < SSAO_CONVERGENCE_THRESHOLD))
 		{
@@ -685,5 +685,5 @@
 	float3 ao;
 	//$$temp matt
-	oldIdx = dummyIdx;
+	//oldIdx = dummyIdx;
 
 	// cull background note: this should be done with the stencil buffer
@@ -758,6 +758,6 @@
 	//-- blend ao between old and new samples (and avoid division by zero)
 
-	OUT.illum_col.x = ao.x;// * newWeight + oldSsao * oldWeight;
-	//OUT.illum_col.x /= (newWeight + oldWeight);
+	OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight;
+	OUT.illum_col.x /= (newWeight + oldWeight);
 
 	OUT.illum_col.y = combinedWeight;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3364)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp	(revision 3371)
@@ -356,7 +356,10 @@
     str.read(reinterpret_cast<char *>(vertices), sizeof(Vector3) * vertexCount);
 	
+	//cout << "vertexCount: " << vertexCount << endl;
+
 	normals = new Vector3[vertexCount];
 	str.read(reinterpret_cast<char *>(normals), sizeof(Vector3) * vertexCount);
 
+
 	Vector3 *tangents;
 
@@ -374,4 +377,5 @@
 	str.read(reinterpret_cast<char *>(&texCoordCount), sizeof(int));
 
+	//cout << "texCoordCount: " << texCoordCount << endl;
 
 	if (texCoordCount)
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 3370)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp	(revision 3371)
@@ -181,6 +181,6 @@
 	for (int i = 0; i < mNumSamples; ++ i)
 	{
-		x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);
-		//mHalton->GetNext(x);
+		//x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);
+		mHalton->GetNext(x);
 		
 		const float a = 2.0f * M_PI * x[0];
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3369)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3371)
@@ -669,7 +669,7 @@
 #if 1
 
-	//LoadModel("hbuddha.dem", dynamicObjects);
+	LoadModel("hbuddha.dem", dynamicObjects);
 	//LoadModel("horse.dem", dynamicObjects);
-	LoadModel("happy2.dem", dynamicObjects);
+	//LoadModel("happy2.dem", dynamicObjects);
 	//LoadModel("torus.dem", dynamicObjects);
 	//LoadModel("venusm.dem", dynamicObjects);
@@ -835,4 +835,5 @@
 	// another color buffer
 	fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST);
+
 
 	for (int i = 0; i < 4; ++ i)
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3370)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3371)
@@ -845,5 +845,6 @@
 
 	//if (mRegenerateSamples)
-	if (1)//mUseTemporalCoherence || mRegenerateSamples)
+	if (//mUseTemporalCoherence || 
+		mRegenerateSamples)
 	{
 		mRegenerateSamples = false;
@@ -860,5 +861,5 @@
 		else
 		{
-			//UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);
+			UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);
 		}
 
@@ -867,6 +868,4 @@
 		//if (mSortSamples) { SortSamples(); }
 		sCgSsaoProgram->SetArray2f(i, (float *)samples2 + dummy, NUM_SAMPLES);
-
-		cout << "d " << dummy << " ";
 
 		dummy = (dummy + NUM_SAMPLES) % NUM_PRECOMPUTED_SAMPLES;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3360)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp	(revision 3371)
@@ -168,4 +168,6 @@
 	geom->mMaterial = mat;
 
+	static int count = 0;
+	if (count ++ < 10)
 	cout << "creating new geometry with " << numElements << " vertices" << endl;
 
@@ -204,5 +206,6 @@
 
 
-bool ObjConverter::Convert(const string &filename, const std::string &outputFilename)
+bool ObjConverter::Convert(const string &filename, 
+						   const std::string &outputFilename)
 {
 	mNumShapes = 0;
@@ -358,45 +361,4 @@
 		str.write(reinterpret_cast<char *>(geom->mTexcoords), sizeof(float) * texCoordCount * 2);
 	
-
-	///////
-	//-- texture
-/*
-#ifdef USE_TEXTURE
-	int texId = 0;
-#else
-	int texId = -1;
-#endif
-
-	str.write(reinterpret_cast<char *>(&texId), sizeof(int));
-
-	bool alphaTestEnabled = false;
-	//bool cullFaceEnabled = false;
-	bool cullFaceEnabled = true;
-
-	str.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool));
-	str.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool));
-
-	// material
-	bool hasMaterial = true;
-	//bool hasMaterial = false;
-	str.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool));
-	
-	if (hasMaterial)
-	{
-		SimpleVec ambient, diffuse, spec, emm;
-
-		ambient.x = ambient.y = ambient.z = 0.2f;
-		//diffuse.x = diffuse.y = diffuse.z = 1.0f;
-		diffuse.x = 0.7f; diffuse.y = 0.5f; diffuse.z = 0.2f;
-		spec.x    = spec.y    = spec.z    =  .0f;
-		emm = spec;
-
-		// only write rgb part of the material
-		str.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec));
-		str.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec));
-		str.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec));
-		str.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec));
-	}
-*/
 }
 
@@ -407,6 +369,5 @@
 	ogzstream ofile(filename.c_str());
 
-	if (!ofile.is_open())
-		return false;
+	if (!ofile.is_open()) return false;
 	
 
@@ -448,33 +409,35 @@
 	{
 		WriteGeometry(ofile, *it);
-	}
-
-	int texId = 0;
-	ofile.write(reinterpret_cast<char *>(&texId), sizeof(int));
-
-	bool alphaTestEnabled = false;
-	//bool cullFaceEnabled = false;
-	bool cullFaceEnabled = true;
-		
-	ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool));
-	ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool));
-
-	// material
-	bool hasMaterial = true;
-	ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool));
-	
-	SimpleVec ambient, diffuse, spec, emm;
-
-	ambient.x = ambient.y = ambient.z = 0.2f;
-	diffuse.x = diffuse.y = diffuse.z = 1.0f;
-	spec.x = spec.y = spec.z = .0f;
-	emm = spec;
-
-	// only write rgb part of the material
-	ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec));
-	ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec));
-	ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec));
-	ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec));
-
+
+		int texId = 0;
+		ofile.write(reinterpret_cast<char *>(&texId), sizeof(int));
+
+		bool alphaTestEnabled = false;
+		//bool cullFaceEnabled = false;
+		bool cullFaceEnabled = true;
+
+		ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool));
+		ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool));
+
+		// material
+		bool hasMaterial = true;
+		ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool));
+
+		if (hasMaterial)
+		{
+			SimpleVec ambient, diffuse, spec, emm;
+
+			ambient.x = ambient.y = ambient.z =  .2f;
+			diffuse.x = diffuse.y = diffuse.z = 1.0f;
+			spec.x    = spec.y    = spec.z    =  .0f;
+			emm = spec;
+
+			// only write rgb part of the material
+			ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec));
+			ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec));
+			ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec));
+			ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec));
+		}
+	}
 
 	int entityCount = 1;
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp	(revision 3360)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp	(revision 3371)
@@ -129,8 +129,5 @@
 				for (int j = 0; j < 3; ++ j)
 				{
-					//if (tIndices[idx[j]] >= (int)texcoords.size())
-						//cerr << "error: texcoord indices exceed array size " << texcoords.size() << " " << tIndices[idx[j]] << endl;
 					const int tidx = min((int)texcoords.size() - 1, tIndices[idx[j]]);
-
 					faceTexcoords.push_back(texcoords[tidx]);
 				}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 3361)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp	(revision 3371)
@@ -1,4 +1,4 @@
-//#include "ObjConverter.h"
-#include "PlyConverter.h"
+#include "ObjConverter.h"
+//#include "PlyConverter.h"
 #include <iostream>
 #include <time.h>
@@ -12,6 +12,6 @@
 
 	//ObjConverter2 converter;
-	//ObjConverter converter;
-	PlyConverter converter;
+	ObjConverter converter;
+	//PlyConverter converter;
 
 	cout << "converting obj to dem format" << endl;
@@ -60,5 +60,5 @@
 
 	cout << "conversion successful" << endl;
-	cout << "press any key" << std::cin.get();
+	//cout << "press any key" << std::cin.get();
 
 	return 0;
