Imagine I have 4 identical objects - (meshes or sprites), they all (could) have the same shader/program, because they are identical.
Each one has its own position and it's rendered in a separate render-call.
Positions of these objects change every once in a while, but not every frame.
I don't know what is the fastest way to handle this:
Each object has its own shader, transforms are stored in the shaders (GPU side)? I need to rebind 4 shaders per frame. When I want to move a certain object I just bind the correct shader and send the new transformation matrix to it.
There is only one shader/program bound for all of these objects? Transformations are stored in a class (CPU side). Every time I render one of these objects I must send its tranforms to the shader, so I send 4 matrices per frame. When I want to move a certain object I just change the value in it's class, but don't need to send anything to the GPU.
Is there any other, better solution?