Changing Uniform Variables for a Single Shader

I’m currently trying to use a single shader to render a bunch of separate objects where each object has their own orientation in the world. I plan on moving to batching soon but some objects will still be separate.

From what I understand the glUseProgram call has quite a lot of OpenGL driver overhead so it would make sense to set a program and reuse it by changing variables for each object I render. The problem is when I do this they seem to all render to the same position on the screen.

What I am trying to do is the following:

glUseProgram(…)

glUniform(…)
glDrawArrays(…)
glUniform(…)
glDrawArrays(…)

The impression I get is that you can only set uniform variables once? From my research I have read that this should be working but please correct me if I’m wrong. I know atleast the shader and the draw code is correct, because when I add the glUseProgram line in between each glDrawArrays call it renders correctly.

With the above logic everything renders in exactly the same position on top of each other, which seems to be the position of either the first or last item to be rendered. This means the transform matrix isn’t being updated but why? If I keep exactly the same code and change it to the following:

glUseProgram(…)

glUniform(…)
glDrawArrays(…)

glUseProgram(…)

glUniform(…)
glDrawArrays(…)

It works as it should, everything rendering in the correct position. All I am doing is moving the glUseProgram call in between the draw calls. Is there any reason this should be happening? I have an error code of 0 each frame.

FYI I am using OpenGL ES 2.0 targeting the iPad.