writing to vbo each frame
I've used vbo's before for terrains - so I create them once and reference to data with them.
Is there any difference for when I write to them each frame - ie when using them for animation and so each triangle will be in a different position ?
Do I have to set them up any differently ?
I read something in the vbo spec about MAP/UNMAp - is this relevant to what I plan to do and if so when do I map/unmap as it seems unclear to me what to do.
cheers
Adrian
map/unmap is probably not the best way to go, depending on how you are doing your animation.
If you are just copying data from another memory location into the VBO then glBufferSubData() is probably going to be the best way todo it. Combine this with getting the driver to release the old VBO and allocate a new one because you dont need the data (do by using glBufferData() with 'null' as the source address) and you should be golden.
However, if you are generating your triangles on the fly a map/unmap might be faster as you can map the location and directly write to it from your generation algo. instead of using an intermediate buffer, which reduces the amount of memory copying work however could result in other stalls.
Try both, see which works for you [smile]
If you are just copying data from another memory location into the VBO then glBufferSubData() is probably going to be the best way todo it. Combine this with getting the driver to release the old VBO and allocate a new one because you dont need the data (do by using glBufferData() with 'null' as the source address) and you should be golden.
However, if you are generating your triangles on the fly a map/unmap might be faster as you can map the location and directly write to it from your generation algo. instead of using an intermediate buffer, which reduces the amount of memory copying work however could result in other stalls.
Try both, see which works for you [smile]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement