Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

OpenGL UniformIndex vs BindingLocation

This topic is 2113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to work with multiple uniform blocks in my shaders.  I've read this page multiple times, but I'm confused about the difference between uniformBlockIndex and uniformBlockBinding.  Say I have a shader with two uniform blocks.  I'd want to call glGetUniformBlockIndex for each named uniform block to retrieve the uniformBlockIndex, and then call glUniformBlockBinding to specify the block index and block binding points.

 

The uniformBlockIndex makes sense to me as the location within the shader where the uniform block resides.  But what is the purpose of uniformBlockBinding then?  Right now I'm specifying that as the same number I got for uniformBlockIndex and everything works fine.  Why would I use something different?

Share this post


Link to post
Share on other sites
Advertisement

Thanks!

 

So as I understand it now, the uniformBlockIndex is the location in the program where data is going to be stored, and the uniformBlockBinding is the binding point in the rendering context where that data is going to reside.  You can use this to switch which GL_UNIFORM_BUFFER that block index will read its data from.

Edited by Funkymunky

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!