Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3034)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp	(revision 3035)
@@ -324,11 +324,9 @@
 
 	sCgSsaoProgram->AddParameter("colors", i ++);
-	sCgSsaoProgram->AddParameter("colors", i ++);
+	sCgSsaoProgram->AddParameter("normals", i ++);
 	sCgSsaoProgram->AddParameter("oldTex", i ++);
 	sCgSsaoProgram->AddParameter("noise", i ++);
 	sCgSsaoProgram->AddParameter("eyePos", i ++);
 	sCgSsaoProgram->AddParameter("temporalCoherence", i ++);
-	sCgSsaoProgram->AddParameter("modelViewProj", i ++);
-	sCgSsaoProgram->AddParameter("oldModelViewProj", i ++);
 	sCgSsaoProgram->AddParameter("samples", i ++);
 	sCgSsaoProgram->AddParameter("bl", i ++);
@@ -336,9 +334,11 @@
 	sCgSsaoProgram->AddParameter("tl", i ++);
 	sCgSsaoProgram->AddParameter("tr", i ++);
+	sCgSsaoProgram->AddParameter("modelViewProj", i ++);
+	sCgSsaoProgram->AddParameter("oldModelViewProj", i ++);
 
 	i = 0;
 
 	sCgGiProgram->AddParameter("colors", i ++);
-	sCgGiProgram->AddParameter("colors", i ++);
+	sCgGiProgram->AddParameter("normals", i ++);
 	sCgGiProgram->AddParameter("noise", i ++);
 	sCgGiProgram->AddParameter("oldSsaoTex", i ++);
@@ -351,4 +351,6 @@
 	sCgGiProgram->AddParameter("tl", i ++);
 	sCgGiProgram->AddParameter("tr", i ++);
+	sCgGiProgram->AddParameter("oldModelViewProj", i ++);
+	sCgGiProgram->AddParameter("modelViewProj", i ++);
 
 	sCgAntiAliasingProgram->AddParameter("colors", 0);
@@ -359,4 +361,25 @@
 	sCgDeferredProgram->AddParameter("lightDir", 2);
 
+	sCgLogLumProgram->AddParameter("colors", 0);
+	
+	sCgToneProgram->AddParameter("colors", 0);
+	sCgToneProgram->AddParameter("imageKey", 1);
+	sCgToneProgram->AddParameter("whiteLum", 2);
+	sCgToneProgram->AddParameter("middleGrey", 3);
+
+	sCgDownSampleProgram->AddParameter("colors", 0);
+	sCgDownSampleProgram->AddParameter("downSampleOffs", 1);
+
+	sCgDeferredShadowProgram->AddParameter("colors", 0);
+	sCgDeferredShadowProgram->AddParameter("normals", 1);
+  	sCgDeferredShadowProgram->AddParameter("shadowMap", 2);
+  	sCgDeferredShadowProgram->AddParameter("noise", 3);
+ 	sCgDeferredShadowProgram->AddParameter("shadowMatrix", 4);
+  	sCgDeferredShadowProgram->AddParameter("sampleWidth", 5);
+	sCgDeferredShadowProgram->AddParameter("lightDir", 6);
+ 	sCgDeferredShadowProgram->AddParameter("eyePos", 7);
+	sCgDeferredShadowProgram->AddParameter("samples", 8);
+	sCgDeferredShadowProgram->AddParameter("weights", 9);
+
 
 	float filterWeights[NUM_PCF_TABS];
@@ -369,6 +392,6 @@
 	}
 
-	sCgDeferredShadowProgram->SetArray2f("samples", (float *)pcfSamples, NUM_PCF_TABS);
-	sCgDeferredShadowProgram->SetArray1f("weights", (float *)filterWeights, NUM_PCF_TABS);
+	sCgDeferredShadowProgram->SetArray2f(8, (float *)pcfSamples, NUM_PCF_TABS);
+	sCgDeferredShadowProgram->SetArray1f(9, (float *)filterWeights, NUM_PCF_TABS);
 
 	PrintGLerror("init");
@@ -501,7 +524,5 @@
 
 	sCgSsaoProgram->SetValue1f(5, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0);
-	sCgSsaoProgram->SetMatrix(6, projViewMatrix);
-	sCgSsaoProgram->SetMatrix(7, oldProjViewMatrix);
-
+	
 	if (mUseTemporalCoherence || mRegenerateSamples)
 	{
@@ -512,5 +533,5 @@
 		// needs longer to converge
 		GenerateSamples(mSamplingMethod); 
-		sCgSsaoProgram->SetArray2f(8, (float *)samples2, NUM_SAMPLES);
+		sCgSsaoProgram->SetArray2f(6, (float *)samples2, NUM_SAMPLES);
 	}
 
@@ -518,8 +539,12 @@
 	ComputeViewVectors(tl, tr, bl, br);
 
-	sCgSsaoProgram->SetValue3f(9, bl.x, bl.y, bl.z);
-	sCgSsaoProgram->SetValue3f(10, br.x, br.y, br.z);
-	sCgSsaoProgram->SetValue3f(11, tl.x, tl.y, tl.z);
-	sCgSsaoProgram->SetValue3f(12, tr.x, tr.y, tr.z);
+	sCgSsaoProgram->SetValue3f(7, bl.x, bl.y, bl.z);
+	sCgSsaoProgram->SetValue3f(8, br.x, br.y, br.z);
+	sCgSsaoProgram->SetValue3f(9, tl.x, tl.y, tl.z);
+	sCgSsaoProgram->SetValue3f(10, tr.x, tr.y, tr.z);
+
+	sCgSsaoProgram->SetMatrix(11, projViewMatrix);
+	sCgSsaoProgram->SetMatrix(12, oldProjViewMatrix);
+
 
 	DrawQuad(sCgSsaoProgram);
@@ -620,7 +645,4 @@
 										const Matrix4x4 &oldProjViewMatrix)
 {
-	sCgGiProgram->SetMatrix("oldModelViewProj", oldProjViewMatrix);
-	sCgGiProgram->SetMatrix("modelViewProj", projViewMatrix);
-
 #if 0
 	GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture();
@@ -677,4 +699,8 @@
 	sCgGiProgram->SetValue3f(11, tr.x, tr.y, tr.z);
 
+	sCgGiProgram->SetMatrix(12, oldProjViewMatrix);
+	sCgGiProgram->SetMatrix(13, projViewMatrix);
+
+
 	DrawQuad(sCgGiProgram);
 
@@ -774,19 +800,18 @@
 	glDrawBuffers(1, mrt + colorBufferIdx);
 
-
-	sCgDeferredShadowProgram->SetTexture("colors", colorsTex);
-	sCgDeferredShadowProgram->SetTexture("normals", normalsTex);
-	sCgDeferredShadowProgram->SetTexture("shadowMap", shadowTex);
-	sCgDeferredShadowProgram->SetTexture("noise", noiseTex);
-
-	sCgDeferredShadowProgram->SetMatrix("shadowMatrix", shadowMatrix);
-
-	sCgDeferredShadowProgram->SetValue1f("sampleWidth", 2.0f / shadowMap->GetSize());
+	sCgDeferredShadowProgram->SetTexture(0, colorsTex);
+	sCgDeferredShadowProgram->SetTexture(1, normalsTex);
+	sCgDeferredShadowProgram->SetTexture(2, shadowTex);
+	sCgDeferredShadowProgram->SetTexture(3, noiseTex);
+
+	sCgDeferredShadowProgram->SetMatrix(4, shadowMatrix);
+
+	sCgDeferredShadowProgram->SetValue1f(5, 2.0f / shadowMap->GetSize());
 
 	const Vector3 lightDir = -light->GetDirection();
-	sCgDeferredShadowProgram->SetValue3f("lightDir", lightDir.x, lightDir.y, lightDir.z);
+	sCgDeferredShadowProgram->SetValue3f(6, lightDir.x, lightDir.y, lightDir.z);
 
 	const Vector3 pos = mCamera->GetPosition();
-	sCgDeferredShadowProgram->SetValue3f("eyePos", pos.x, pos.y, pos.z);
+	sCgDeferredShadowProgram->SetValue3f(7, pos.x, pos.y, pos.z);
 
 	DrawQuad(sCgDeferredShadowProgram);
@@ -846,5 +871,5 @@
 	glDrawBuffers(1, mrt + colorBufferIdx);
 	
-	sCgLogLumProgram->SetTexture("colors", colorsTex);
+	sCgLogLumProgram->SetTexture(0, colorsTex);
 	DrawQuad(sCgLogLumProgram);
 	
@@ -897,10 +922,10 @@
 	glViewport(0, 0, downSampleFbo->GetWidth(), downSampleFbo->GetHeight());
 	
-	sCgDownSampleProgram->SetTexture("colors", colorsTex);
+	sCgDownSampleProgram->SetTexture(0, colorsTex);
 
 	float downSampleOffsets[NUM_DOWNSAMPLES * 2];
 	ComputeSampleOffsets(downSampleOffsets, fbo->GetWidth(), fbo->GetHeight());
 
-	sCgDownSampleProgram->SetArray2f("downSampleOffs", (float *)downSampleOffsets, NUM_DOWNSAMPLES);
+	sCgDownSampleProgram->SetArray2f(1, (float *)downSampleOffsets, NUM_DOWNSAMPLES);
 
 	mDownSampleFbo->Bind();
@@ -928,8 +953,8 @@
 	glDrawBuffers(1, mrt + colorBufferIdx);
 
-	sCgToneProgram->SetTexture("colors", colorsTex);
-	sCgToneProgram->SetValue1f("imageKey", imageKey);
-	sCgToneProgram->SetValue1f("whiteLum", whiteLum);
-	sCgToneProgram->SetValue1f("middleGrey", middleGrey);
+	sCgToneProgram->SetTexture(0, colorsTex);
+	sCgToneProgram->SetValue1f(1, imageKey);
+	sCgToneProgram->SetValue1f(2, whiteLum);
+	sCgToneProgram->SetValue1f(3, middleGrey);
 
 	DrawQuad(sCgToneProgram);
