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 4 of 4

Thread: Accepted practice for VBO's

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    12

    Accepted practice for VBO's

    I am new to OpengGL. The tutorials that I have read explain how to pass vertex data to the GPU using vertex buffer objects. I have this working fine for a single mesh. For a scene consisting of many meshes (for example, one mesh per object in the scene or perhaps several meshes for a single complex object), is it standard practice to create a VBO for each mesh?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    It's a pretty standard (but probably bad) practice to create a VBO for each mesh. If I would be you, I'd put multiple meshes into a single large buffer as then you can avoid batch breaking buffer switches. However, it really depends on your renderer's needs and design.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,095
    I batch meshes together where the data is relatively static and have separate buffers where the mesh is like to be deleted or change in size

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,123
    As suggested, be careful with the VBO per mesh approach. Lots of buffer switching is expensive and eats your performance, especially on slower CPUs/memories. Thus NVidia bindless GL extensions and the very nice speed-up this provides in those situations.

    An alternative approach is a "streaming VBO" type approach where you copy your batches to render into a big "ring buffer" VBO, possibly with reuse across multiple frames. This is ideal for the case where your batch data is dynamically discovered (loaded/built/etc.) during runtime. This also avoids the lots-o-buffer-binding perf issue. There are articles in the archives on how to do this streaming very efficiently if you care. For instance, here.

Posting Permissions

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