I'm writing a CAD system. I have a 3D scene and there are many different objects (walls, doors, windows and so on). The user can add or delete objects. The question is: How do I keep track of all the vertices for all my objects?

I can create vertex buffer for every object. But I think drawing/switching from one buffer to another would have performance penalty.

Another way - I can create several big buffers for every object type. But I don't understand how to update such buffers. It is too big to update whole buffer (for example buffer for all walls). What would I do if I wanted to delete an object that's in the middle of the buffer?

I have the similar question here on Stack Overflow.

Most examples I've found work with static models. Therefore, they tend to create a single vertex buffer with their list of points, and then are just manipulated by matrix transformations. I, on the other hand, will be updating the scene very often. So what's the best way to keep track of and store this information?


1 Answer 1


This is a fairly clear case of premature optimization. You have no performance data saying that there will be any need for optimization.

Simply make one vertex buffer per separate object that the user wants to edit, by the time your seeing performance problems you can start profiling your code for the bottlenecks. In particular, swapping vertice buffers is not a very time consuming task, draw calls is the bottleneck there.

Your likely bottle neck will either not exist (for smaller parts style CADing) or be a matter of too many triangles (for town CADing), in this latter case you would be using efficient culling to reduce the problem, this is easier to do with several objects instead of a singular huge one.

Im hoping this makes sense, was written a bit hastily I'm afraid.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .