i want to use bindable uniform buffers to swap the uniform data fast within my main program logic. But this does not seems to work. My image is just black. Perhaps someone sees a problem within my code?
And i have another question. I wonder if using texture buffer objects (tbo) via uniform ‘samplerBuffer’ swaps the data as fast a normal sampler which is declared as bindable would do. Are those both extensions comparable? They are both backed up by a buffer object and therefore comparable, nor?
Don’t use EXT_bindable_uniform. It’s not a very good spec; it’s hard to know how everything should be laid out in the buffer object. Any hardware that could support it also supports ARB_uniform_buffers, which is a much better spec.
Why are you using GL_STATIC_READ? Since glBufferData’s usage is just a hint, I don’t think this is the problem, but if you plan on writing to the buffer frequently, you should provide an appropriate hint. See NVIDIA’s Using VBOs, the advice also applies to UBOs.
yes i want to write to the buffer frequently. I just used GL_STATIC_READ because i thought it should work with any mode? I switched to GL_DYNAMIC_READ by my float is still 0.0.
Perhaps Alfonse is right and the bindable extension is not quite good and i should use buffer objects without it instead. But i thought i could save some time which is consumed when redefining the uniform via glUniform1f(loc2,sc); eg. Instead of using glBindBuffer. And i can only use glBindBuffer to change my uniform value (without calling a glUnform** call) when using texture buffer objects via a sampler buffer samplerBuffer.
The bindable uniform extension sounds like i could make any uniform type accessible via a buffer object and therefor using the DMA direct memory access performance benefit. As described for buffer objects.
I hope i made my point clear enough. If not so please tell me and i try to clarify my self.
Perhaps Alfonse is right and the bindable extension is not quite good and i should use buffer objects without it instead.
That’s not what I said. EXT_bindable_uniform and ARB_uniform_buffer_objects both do the same thing. They allow you to store uniforms in buffer objects. It’s just that the ARB extension is better in every way.
I once used the EXT_bindable_uniform extension just when it was released. I had to notice that a float,vec2,vec3 and vec4 always do take the size of 4 floats. So basically if you have a bindable uniform of the type float you would still have to use a buffer of the size of 4 floats where the last 3 ones are unused.
Exactly because of this memory layout problem it was recommended to you to use the ARB extension.