Original Post
*Ahem* Before I say anything I apologize if I make anyone cringe in my bad coding-style...
Ok... I finally decided that my 2D classes (CBitmap, CSprite, CBillboard, CParticleSystem, etc) were getting a bit out of hand since every instance of each class had its own VB ! Rediculous I know, so I decided to try to fix said problem. I understand how to lock, copy memory, unlock the VB and all that good stuff, and also I can store the index to where a specific instance of a class''s vertices are in the VB. The problem is that I don''t know how big to make the vertex buffer. I mean, if I''m in-game I may only have, say, 20 vertices in that buffer, because I''m only rendering 5 bitmaps for health, etc. However, say I chuck a grenade, and all of a sudden I''m using a billboard for the fire and a particle system for the smoke, the vertex count goes up a lot! How can I deal with resizing the vertices and, if necessary, recalculate the indices for each instance?
As of now I have a global LPDIRECT3DVERTEXBUFFER9 g_p2DVB; and it''s declared as an extern in each class file. Then, I initialize and I just create a massive VB that will obviously handle most anything I could want, and then fill and blahdy blah that. I see that is horribly inefficient, and there''s got to be a better way. So... Can you resize a VB??