=== modified file 'shader.cpp'
--- shader.cpp	2010-07-07 10:32:18 +0000
+++ shader.cpp	2010-07-08 08:16:07 +0000
@@ -10,11 +10,11 @@
     fp = fopen(FileName,"rt");
 
     fseek(fp, 0, SEEK_END);
-    
+
     flength = ftell(fp);
-    
+
     rewind(fp);
-    
+
 
     DATA = (char *)malloc(sizeof(char) * (flength+1));
     flength = fread(DATA, sizeof(char), flength, fp);
@@ -33,31 +33,65 @@
 void Shader::load(const char *pVertexShaderFileName, const char *pFragmentShaderFileName)
 {
     char *vertex_shader_source, *fragment_shader_source;
-    
-	mVertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER);
-	mFragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER);
-
-	vertex_shader_source = readShaderFile(pVertexShaderFileName);
-
-	fragment_shader_source = readShaderFile(pFragmentShaderFileName);
-
-	const char *vs = vertex_shader_source;
-	const char *fs = fragment_shader_source;
-
-	glShaderSourceARB(mVertexShader, 1, &vs, NULL);
-	glShaderSourceARB(mFragmentShader, 1, &fs, NULL);
-
-	free(vertex_shader_source);
-	free(fragment_shader_source);
-
-	glCompileShaderARB(mVertexShader);
-	glCompileShaderARB(mFragmentShader);
-
-	mShaderProgram = glCreateProgramObjectARB();
-	glAttachObjectARB(mShaderProgram, mFragmentShader);
-	glAttachObjectARB(mShaderProgram, mVertexShader);
-
-	glLinkProgram(mShaderProgram);
+    char msg[512];
+
+    mVertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER);
+    mFragmentShader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER);
+
+    vertex_shader_source = readShaderFile(pVertexShaderFileName);
+
+    fragment_shader_source = readShaderFile(pFragmentShaderFileName);
+
+    const char *vs = vertex_shader_source;
+    const char *fs = fragment_shader_source;
+
+    glShaderSourceARB(mVertexShader, 1, &vs, NULL);
+    glShaderSourceARB(mFragmentShader, 1, &fs, NULL);
+
+    free(vertex_shader_source);
+    free(fragment_shader_source);
+
+    glCompileShaderARB(mVertexShader);
+    glGetShaderInfoLog(mVertexShader, sizeof msg, NULL, msg);
+    if (strlen(msg) > 0)
+        printf("%s: %s", pVertexShaderFileName, msg);
+
+    glCompileShaderARB(mFragmentShader);
+    glGetShaderInfoLog(mFragmentShader, sizeof msg, NULL, msg);
+    if (strlen(msg) > 0)
+        printf("%s: %s\n", pFragmentShaderFileName, msg);
+
+    mShaderProgram = glCreateProgramObjectARB();
+    glAttachObjectARB(mShaderProgram, mFragmentShader);
+    glAttachObjectARB(mShaderProgram, mVertexShader);
+    glBindAttribLocation(mShaderProgram, 0, "position");
+    glBindAttribLocation(mShaderProgram, 1, "normal");
+    glBindAttribLocation(mShaderProgram, 2, "texture");
+
+    glLinkProgram(mShaderProgram);
+    glGetShaderInfoLog(mShaderProgram, sizeof msg, NULL, msg);
+    if (strlen(msg) > 0)
+        printf("Shader Linking: %s\n", msg);
+
+    mLocations.ModelViewProjectionMatrix = glGetUniformLocation(mShaderProgram,
+            "ModelViewProjectionMatrix");
+    mLocations.NormalMatrix = glGetUniformLocation(mShaderProgram,
+            "NormalMatrix");
+    mLocations.LightSourcePosition = glGetUniformLocation(mShaderProgram,
+            "LightSourcePosition");
+    mLocations.LightSourceDiffuse = glGetUniformLocation(mShaderProgram,
+            "LightSourceDiffuse");
+    mLocations.MaterialDiffuse = glGetUniformLocation(mShaderProgram,
+            "MaterialDiffuse");
+#ifdef _DEBUG
+    printf("Uniform Locations: %d %d %d %d %d\n",
+            mLocations.ModelViewProjectionMatrix,
+            mLocations.NormalMatrix,
+            mLocations.LightSourcePosition,
+            mLocations.LightSourceDiffuse,
+            mLocations.MaterialDiffuse);
+#endif
+
 }
 
 void Shader::use()

=== modified file 'shader.h'
--- shader.h	2010-07-07 10:32:18 +0000
+++ shader.h	2010-07-08 08:16:07 +0000
@@ -17,6 +17,13 @@
     GLuint mVertexShader;
     GLuint mFragmentShader;
     int mShaderProgram;
+    struct {
+        GLint ModelViewProjectionMatrix;
+        GLint NormalMatrix;
+        GLint LightSourcePosition;
+        GLint LightSourceDiffuse;
+        GLint MaterialDiffuse;
+    } mLocations;
 };
 
 #endif

