Hello all,

I’ve been pulling my hair out trying to figure out why I’m having so much trouble passing an array of glm::vec3 to my fragment shader. I know I’m missing something stupid, but I just can’t see it. I’m declaring an array of Point Light positions in my OpenGL code like so:

```
glm::vec3 pointLightPositions[] = {
glm::vec3( -3.5f, 4.0f, -4.0f),
glm::vec3( 0.0f, 4.0f, -4.0f),
glm::vec3( 3.5f, 4.0f, -4.0f),
glm::vec3( -3.5f, 4.0f, 0.0f),
glm::vec3( 0.0f, 4.0f, 0.0f),
glm::vec3( 3.5f, 4.0f, 0.0f),
glm::vec3( -3.5f, 4.0f, 4.0f),
glm::vec3( 0.0f, 4.0f, 4.0f),
glm::vec3( 3.5f, 4.0f, 4.0f)
};
```

Then in my fragment shader I do a simple declaration like so:

```
uniform vec3 pointPositions[9];
```

Then in my OpenGL code I’m using this to set the values:

```
for(int i = 0; i < 9; ++i)
{
glUniform3f(glGetUniformLocation(floorShader.Program, "pointPositions[i]"),
pointLightPositions[i].x, pointLightPositions[i].y, pointLightPositions[i].z);
}
```

I get no compile errors with this code and everything seems fine, but it acts like there is no data in the uniform array. (i.e. all of my lights are clustered at 0,0,0).

If populate the array in the shader itself like so:

```
vec3 pointPositions[9] = vec3[](
vec3( -3.5, 4.0, -4.0),
vec3( 0.0, 4.0, -4.0),
vec3( 3.5, 4.0, -4.0),
vec3( -3.5, 4.0, 0.0),
vec3( 0.0, 4.0, 0.0),
vec3( 3.5, 4.0, 0.0),
vec3( -3.5, 4.0, 4.0),
vec3( 0.0, 4.0, 4.0),
vec3( 3.5, 4.0, 4.0)
);
```

Then everything works fine and the lights are in their proper positions. What I really want is to be able to use glUniform3fv and pass the whole array in one shot, but I can’t seem to figure that out either. (What I really, really want is to use a Uniform Buffer Object, but I won’t go into the nightmare time I had trying to do that)

It seems like such a simple request, pass an array of vec3 to the fragment shader. Please help save my sanity and tell me my stupid mistake.

Per the posting guidelines, here is my environment:

OS: Linux Mint 14 64 bit

Graphics Card: Nvidia GeForce GT 630

Driver: Nvidia binary driver 352.63

Using Shaders: YES

OpenGL Core: 3.3

Toolkit: GLFW