PDA

View Full Version : glMultiDrawElements and Uniforms



mscar
10-18-2011, 09:18 AM
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?

Thanks.

_arts_
10-18-2011, 09:31 AM
Yes.

Aleksandar
10-18-2011, 09:43 AM
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.