Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: UBO Usage Query

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2

    UBO Usage Query

    Hiya,

    I'm using three 'types' of UBOs in my application: per-frame camera parameters, per-material parameters and per-instance transform parameters. I believe this is the correct way of using UBOs.

    I've used glUniformBlockBinding to assign binding point 1 to the shared camera parameters, and binding point 2 to the per-instance parameters as a matter of convention. I'm not so sure what to do with material parameters, since each material needs its own UBO (set once at load time). Should I use successive binding points for each material UBO - 3, 4, 5, etc?

    Any advice is much appreciated.

    Cheers.

  2. #2
    Senior Member OpenGL Pro BionicBytes's Avatar
    Join Date
    Mar 2009
    Location
    UK, London
    Posts
    1,171
    I always thought the goal of UBOs was to share uniform resources across multiple shaders. If you are not accessing the UBO from more and one or two shaders, then you're wasting your time codeing this way and performance will actually drop.
    So, are your material UBOs being access by more than 1 or 2 shaders each? The same question with the per-instance UDBOs?
    Camera UBOs are quite possibly one of the best case uses of UBO IMHO.

  3. #3
    Newbie Newbie
    Join Date
    Aug 2012
    Posts
    2
    Thanks.

    I think I'm justified in using UBOs for per-material data - if a material has 10 parameters then I can either call glUniform() for each parameters when I use that material, or I can upload the UBO data once on load and call glBindBufferRange(). That has to be faster, right?

    As for per-instance data - is glUniform() really faster than glBufferSubData() for switching in instance parameters? If so, can anyone tell me why?

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •