Some more tips for cross-platform uniform access:
1. Initializing uniforms (and arrays) with default values was only added in GLSL 120 +. Make sure you add
to the top of your shader.
2. It's usually good practice to specify a length:
float a = float(3.4, 4.2, 5.0, 5.2, 1.1);
3. Certain drivers will not support dynamic indexing. For example, if you're using GL ES (WebGL, iOS, etc) then don't expect dynamic indexing of uniforms to work across all platforms. In your case the index won't be dynamic, but it's best just to stick to "static" indices where possible.
4. Initializing arrays in the shader doesn't work at all in Mac OSX <= 1.7
. I haven't tested later versions of OSX.
5. You can access certain elements of an array by including the index in the name when using glGetUniformLocation:
glGetUniformLocation( program, "LightPos" )
Oddly, in WebGL, I found this was the only way I could update an entire array of values with glUniform4fv.