Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualLaval B

Posted 04 July 2013 - 10:47 AM

Hello everyone.

 

 

I'm thinking about how i would implement a parameter system using OpenGL 3.2+ (core profile) and GLSL. I'm talking about uniform (not including samplers) and not vertex attributes. I'm leaning toward using UBOs and uniform blocks in shaders. Here are a few of points i'm not sure about.

 

  1. I'm planning to use only one big UBO which will contain all the parameters for all uniform blocks in all programs, specific parameters being updated using an appropriate call to glBufferSubData. So, all uniform blocks a program uses would be associated to the same uniform binding point, let's say 0, using glUniformBlockBinding and glBindBufferRange. Another interesting thing about using only one UBO is that i can bind this UBO at load time and keep it bound during rendering (no need to bind an UBO every time i need to update a parameter). Is it that correct and is there any problem with this method ?
  2. Since association happens only at initialization time, the uniform block index returned by glGetUniformBlockIndex doesn't need to be kept into a variable assuming this association doesn't change, correct ?

#1Laval B

Posted 04 July 2013 - 10:45 AM

Hello everyone.

 

 

I'm thinking about how i would implement a parameter system using OpenGL 3.2+ (core profile) and GLSL. I'm talking about uniform (not including samplers) and not vertex attributes. I'm leaning toward using UBOs and uniform blocks in shaders. Here are a few of points i'm not sure about.

 

  1. I'm planning to use only one big UBO which will contain all the parameters for all uniform blocks in all programs, specific parameters being updated using an appropriate call to glBufferSubData. So, all uniform blocks a program uses would be associated to the same uniform binding point, let's say 0, using glUniformBlockBinding and glBindBufferRange. Another interesting thing about using only one UBO is that i can bing this UBO at load time and keep it bound during rendering (no need to bind an UBO every time i need to update a parameter). Is it that correct and is there any problem with this method ?
  2. Since association happens only at initialization time, the uniform block index returned by glGetUniformBlockIndex doesn't need to be kept into a variable assuming this association doesn't change, correct ?

 


PARTNERS