Updating uniforms between sets of primitives

Hello,

I’m currently rendering geometry stored in indexed vbos and managed by vaos. I use glDrawElements to draw the vbo on the screen.
Now I’ve got the problem that I store different (more complex) geometry in one vbo. Each of these geometries requires the same type of uniforms but in order to render each one properly I need to change the uniform between those sets of primitves which form one of my geometries.

I’ve read several wiki-entries mentioning that changing uniforms between draw-calls on one vbo is possible but I don’t see how to do it with drawElements.
Can someone help me?

Thank you,
GreenOwl

Setting constant memory values is possible at any time while a shader program is active. It has nothing to do with the bound VBO or VAO. You can go crazy on a shader program and not issue a single draw call, and you can draw 1000s of objects without changing the program or anything associated with this program. The only interaction points between programs and vertex buffer objects are established by binding attributes to indices associated with shader inputs. Show us the code you have and we’ll see what you can do.

Why do you think glDrawElements differs from any other draw call? Changing uniforms between draw calls is as simple as follows:


glUniform*(...);
glDrawElements(...);
glUniform*(...);
glDrawElements(...);
glUniform*(...);
glDrawElements(...);

On the other hand, if you want to change a uniform value during a draw call, that is impossible. That is a case where attributes take part…