Vertex Buffer Object question

Started by
2 comments, last by Waterwalker 14 years, 12 months ago
Do you think having a single vertex buffer object class for all the shape/mesh/models is better than having more than one each? If you don't get it, I'll try to explain it. Example: I have a triangle shape. I call vbotriangle->create(); to create the vbo for that certain shape then call another for another example for mesh, vbomesh->create() to create for that certain shape. Is better than, For all the triangle,mesh and etc, I have only 1 class vbo so it means all the information for all the mesh and triangle is stored in a single class so if I call the draw function, it will draw everything with just a single call. So which one is better? Hope you understand. DarkBalls [Edited by - DarkBalls on April 21, 2009 1:54:26 PM]
Advertisement
Generally, you want to try to have as few VBOs as possible--but sometimes this isn't practical.

-Static objects should be drawn as one VBO; not many (like one for each tri).

-If you want to change an object, you can use a dynamic VBO, updating as many triangles as you want.

-If you have many static objects that are just moving relative to each other, you likely want a separate VBO for each to avoid the overhead of updating a single big VBO that groups all the objects together.

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

I'm creating a 3d game engine so what should I do? Should I separate it for easy organization over speed?
It depends on the level of abstraction. You can decide not to export a BVO interface at all. Just let the user create a shape. The engine internally takes care of sorting the geometry into a VBO where the data fits.

Do not create a single VBO for each shape. Switching VBO means overhead you do not want to have. But also do not just use one big VBO since this makes it slow for the driver to move the VBO in memory when necessary.

You should try googling for optimal VBO size in MB there should be some information available.
------------------------------------I always enjoy being rated up by you ...

This topic is closed to new replies.

Advertisement