Question

What will be returned by glGetActiveUniformBlock with GL_UNIFORM_BLOCK_BINDING, if specified uniform block was not bound to any binding index? http://www.opengl.org/sdk/docs/man4/xhtml/glGetActiveUniformBlock.xml says:

If no uniform block has been previously specified, zero is returned.

Does it mean that zero will be returned for unbound block? If yes, does it mean that after program linkage all unifrom blocks are bound to zero bining index by default? Again, if yes, then how can I tell if specified block is bound to zero or it was never bound to any index?

Was it helpful?

Solution

To your first two question, yes.

Again, if yes, then how can I tell if specified block is bound to zero or it was never bound to any index?

You don't. Then again, what purpose would that serve? You should either be setting these from your code or from the shader. In both cases, you know what was set because you set it. Unless you're writing some shader tool that asks the user to specify a binding, then it shouldn't matter.

And if you are writing such a tool, then simply show the user what all of the bindings are. If multiple uniform blocks use the same index, then it's illegal for the user to proceed until they resolve the conflict (or confirm that it's what they really want).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top