I'm learning OpenGL and I haven't seen any advice on managing vertex buffers in all of the tutorials I've read.
The basic problem is that I have some memory allocated as a buffer B in which I'm going to store vertex data to send to the graphics card.
Then I have the data that represents my domain D. This is the data that the game's simulation is run against. Let's say in a simple case it's just a list of 100,000 circles that will be moving around. Let's also assume that all of the data can, but might not, change every frame. Nothing is necessarily static.
I'm looking for the techniques people use to efficiently fill B with D.
I could create a new B each frame, but I imagine that would be very expensive.
I could give every object in D a pointer to a location in B and have it update that pointer directly, but that strikes me as error prone as then I have to manage all of these pointers.
I could also traverse D and fill a reused B every frame. This is what I'm currently leaning towards. The only problem here is that I'm forced to update every vertex in B every frame (because the location of the vertex data for a particular D could change within B) unless I come up with a more sophisticated scheme that guarantees that that an object in D always gets the same spot in B.
So I can think of several options, but I'm wondering what people typically do. I imagine almost everyone has to solve this problem at some point.