Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using 3 'types' of UBOs in my application: per-scene camera parameters, per-material parameters and per-object transform parameters.

I've used glUniformBlockBinding to assign the camera parameters to binding point 1, and the per-object parameters to binding point 2 - these are shared 'global' UBOs.

Each material needs it's own UBO to store the material parameters. Should I be using successive binding points for each material UBO - 3, 4, 5 etc?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You should put all materials in the same binding point. You don't bind every material you could ever use at the same time; you bind them as you need them.

Just as you don't bind every texture you could ever possibly need all at once. When rendering model A, you bind the textures and UBOs that model A needs, then when rendering model B, you bind the ones that it needs.

share|improve this answer
    
Aha! Thanks - I thought assigning bindings was an initialisation thing. –  James Aug 8 '12 at 22:55
    
@James: Assigning the bindings to a program is initialization (though you could do it later). Actually doing the bindings is runtime. You don't need a separate binding for each material you have. You just need a specific binding point for each type of thing you're using. –  Nicol Bolas Aug 8 '12 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.