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?

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.

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

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.