Original Post
Hello, I have some questions about vertex buffers management. Let's say we have a scene composed of: - the world (walls, terrain, etc.), which is static data; - the objects (represented by 3D models), which are dynamic data (because they are animated). When rendering the scene, I have determined a small part of world data and a subset of objects to be drawn. How to render all that stuff using Vertex Buffer Objects? More precisely: *Assuming I compute the animated vertices only for the rendering stage, i.e. I can put them in Video RAM I won't read them back* For the world (static data), I would put everything in one static VBO. For the objects (dynamic data), how many VBOs should I use? is it better to: - use one big vertex buffer? This VBO would be filled with all objects I have to draw, and then rendered in "one stage" (with respect to objects' textures and shaders). The VBO would be cleaned up after each frame, and could be reused for the next frame. It would avoid multiple memory allocations for the "final" vertex data, but I would have to prepare animated vertices of all objects before drawing (or maybe I could draw them independently -- drawing one object during vertex computations for the next one, etc., even if they are stored on the same buffer?) - use a vertex buffer for each object? Since the number of objects to be drawn on the scene is variable, I would have to create/destroy a VBO for each object for each frame. Or maybe I could keep some VBOs and reuse them for others objects during the next frame? I don't know the cost of creating/destroying a VBO. - use multiple VBOs of a "medium" size, in which I could fill multiple objects. I could render objects of a VBO when it is "full", and compute vertices+fill next VBO for the next objects. I could avoid creating/destroying a lot of VBOs. This is like a mix of the two previous solutions. Also, do you think it's better to prepare all vertex data (CPU) and then draw every thing (GPU), or prepare vertex data for an object, then render it, then prepare the next object, render it, etc.? Thanks.