   Beginner for Vertex Buffer Implementation
  I am working on a 3D/2D Game engine using DirectX9. I'm at the point of just beginning to write the base scene class and finding it very challenging to figure out in what way I should implement vertex buffers. I know how to use them but not when or where. Tutorials show it used in a very simple manner, but not in a way that would work for an engine with multple objects, scenes, etc.How are Vertex Buffers normally implemented? Purhaps have one Vertex Buffer for a scene? But then it would be difficult for me to decide how to handle when an object is taken out of a scene and put into another for example.I guess in simple terms that I know how to create vertex buffers, but not how to make use of them in my engine. How are they implemented?   
  There is no single "right way" of implementing an engine using vertex buffers.You should think of it more in terms of how you're going to use the content stored in them:1. Group data with the same FVF/declaration together2. Group data that is going to be modified regularly, occasionally or never (so you can get the usage/locking flags optimal)3. Group data that will be rendered with the same pipeline configuration (e.g. effects/textures) - this will help reduce unnecessary state changes.Also, the size of the VB can be important - some of the older ATI/NV slide decks suggest a maximum of 4mb (or so) for a VB; this might well eliminate the option of having a "super vertex buffer".Having a single vertex buffer for every object isn't necessarily bad (it's what you'd get if you used lots of ID3DXMesh objects).Also, give thought to using index buffers - you can then make use of vertex-cache optimizations, reduce storage overhead (by re-using vertices) and so on...hthJack   ;  Thanks for that information. It's helping.So I am looking at having 2 or 3 Vertex Buffers in my scene class. One for moveable objects (Players and things), one for terrain (static), and possibly one for sky.I'm still struggling with one part that I havn't seen a solution for. So I have my Vertex Buffer and then I remove an object from the scene. Also suppose I add an object to the scene while the game is in progress. I'm not sure it would make sense to rearrange all the data in the buffer to accomodate those situations. Would I just recreate the buffer entirely if something like that changes?   ;  It's a good idea to load all your objects up front (i.e., load an entire level). This way you don't get slowdowns while the game is running. (On the other hand, loading a level can be slow this way.) Then you don't have a problem arranging your objects.But initially I'd suggest just using one vertex buffer per object, since it'd work with any way you load your objects, and is easy to implement. Looking forward, you could code such that it'd be easy to change to fewer vertex buffers later.   ;Quote:Original post by jollyjeffersAlso, the size of the VB can be important - some of the older ATI/NV slide decks suggest a maximum of 4mb (or so) for a VB; this might well eliminate the option of having a "super vertex buffer".Why would someone want to do that in the first place? Is there some speed/cache gain from this? I've heard of this before somewhere, but never actually give it any deeper thought...Isn't having a single buffer forcing your application to manage memory distribution for it? Isn't it better to just let those issues be handled on the driver level? But on the other hand, I could see it having advandages just as using memory pools instead of malloc - is this the case?--As for me, I'm using an independent vertex buffer (+index buffer) for each geometry chunk. Only use a "big buffer" for particles.   