Sign in to follow this  
beebs1

Uniform Buffer Query

Recommended Posts

Hiya,

I have a quick question about uniform buffers I was hoping someone could answer.

I have 3 'types' of UBOs in my application:
[b]Camera Parameters[/b] - Global camera parameters for the scene (updated once per frame).
[b]Object Parameters[/b] - Per-object transform (updated once per object).
[b]Material Parameters[/b] - Updated once for each material used in a frame.

I believe this is the correct way of using UBOs.

The question is regarding the binding point I should specify in [font=courier new,courier,monospace]glUniformBlockBinding()[/font]. The camera parameters will be shared between all objects (and therefore programs), and so it can always be set to binding point 0.

I'm not sure what to do about the per-object and per-material UBOs. Should I be using successive binding points for each UBO - 1, 2, 3 etc?

Thanks for any help! Edited by Telios

Share this post


Link to post
Share on other sites
[quote name='Telios' timestamp='1344461653' post='4967542']
The question is regarding the binding point I should specify in glUniformBlockBinding(). The camera parameters will be shared between all objects (and therefore programs), and so it can always be set to binding point 0.

I'm not sure what to do about the per-object and per-material UBOs. Should I be using successive binding points for each UBO - 1, 2, 3 etc?
[/quote]

Yes. That way you only have to call glUniformBlockBinding() once for every program, in the initialization phase.

I had a problem for thjis with AMD, but not NVIDIA. The binding got lost now and then, and I had to call it again. I found that a call of glDeleteBuffers() for buffer 0 destroyed the binding point 0 for UBO:s. That should not be related, but I think it is a bug in the AMD driver.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this