PDA

View Full Version : Question reguarding VBO's



grxmx
07-13-2005, 12:15 PM
Ive been somewhat out of the loop of recent additions to the new OpenGL versions... 1.2 and later really, and I'm trying to get up to date. Ive got a lengthy math/graphics engine that is OpenGL based which I began in 1999.

Maintainence of object data lists (vertex, normal, texture, index..etc) are all controlled by a large class that maintains any added objects in a scene. It also maintains a very large global vertex/index/normal list so that new objects are added via the maintainence class to the global list.

To boost efficiency, I'd like to start using VBO's rather than maintaining such huge lists in client memory. Now, to me, its slightly unclear as to whether or not its possible to add/modify/remove objects from/in the VBO, and how access might be granted to it. It'd be redundant to keep a local copy of these lists, so they'd be "free"'d.

Normally, most of the interaction with the global list only occurs at load time, loading models/meshes and such. However, if an object were to be added later in a scene, how would one go about adding the data to the lists? I couldnt see any clear facility in the specification of GL_ARB_vertex_buffer_object for adding/removing/modifying data or for resizing the lists as you would for C-type arrays, if its even possible.

Humus
07-13-2005, 05:41 PM
You can modify data with glBufferSubDataARB(), or you can map it with glMapBufferARB() and update the buffer through the returned pointer.

Korval
07-13-2005, 06:46 PM
If you load a new object, you should just create a new VBO, rather than attempting to resize them dynamically and so forth. Unless your objects are small, having multiple buffer objects is perfectly reasonable.

grxmx
07-13-2005, 07:35 PM
Ok, thats exactly what I was looking for. I didnt know if having multiple VBO's was something that wasnt good practice or not. About 90% of what is actually contained in the vertex lists is instantiated at load time. Everything else, normally small, is done on the fly.

For instance rocket flares or any misc. transient objects not persistent throughout the simulation, would it be MORE of a performance hit to create multiple tiny VBO's or to just malloc/free the memory and use conventional glVertex/glNormal while reserving a very large VBO for complex underlying meshes and models?

jide
07-14-2005, 12:27 AM
VBO for dynamic draws are very fast, copying memory to them is very fast and take profit from AGP/PCI express. Immediate mode will never.