glMultiDrawElements and Uniforms

In my earlier code, I looped through the objects in the model and set each object’s color with glUniform3fv before drawing it with glDrawElements.

But now I’m combining all the object data into one VBO and drawing it with glMultiDrawElements. This is convenient because I’m using OpenGL-OpenCL interoperability. But how can I set uniform data for each object if I’m not drawing each object separately? Do I need to set the color on a per-vertex basis?



I don’t understand why OpenGL/OpenCL interoperability requires using glMultyDrawElements, but I believe if you say so.

Considering uniforms, the usage is quite simple. You cannot change uniform value during the draw call. That’s what the attributes serve for.