PDA

View Full Version : Multiple Uniform Bufffers



Septimra
07-12-2015, 05:54 PM
Alright. I decided to tackle instancing, then if memory becomes an issue I can always dial it down. But I am trying to create a shader with 2 uniform block bindings, but the strangest thing happens.

I have

uniform a{
};

uniform b{
};

However when I attempt to use b, it will fail. However the program does not crash.

When I disable a--not use it in my shader, and not populate in my cpps-- OpenGL will use b properly.

How would I use multiple uniform blocks?

GL_MAX_UNIFORM_BUFFER_BINDINGS gives 70, so I should be allowed 70 uniform blocks at maximum.. right?

Septimra
07-13-2015, 06:21 AM
I solved the problem. You allocate a uniform buffer binding point buffer and bind it. Then you use glGetUnifromBlockIndex() to bind the index the the buffer binding point. GL_MAX_UNIFORM_BUFFER_BINDINGS means that you can do glBindBufferBase/Range(GL_UNIFORM_BUFFER, 0-70 , uboID)