Search code examples
openglvertex-buffer

Better to create new VBOs or just swap the data? (OpenGL)


So in a OpenGL rendering application, is it usually better to create and maintain a vertex buffer throughout the life of an application and just swap out the data every frame with glBufferData, or is it better to just delete the VBO and recreate it every frame?

Intuition tells me it's better to swap out data, but a few sample programs I've seen does the latter, so I'm kind of confused.

I read Nvidia's whitepaper on VBOs, but as I'm a newbie to opengl, it didn't make a whole lot of sense.

Thanks in advance for and advice


Solution

  • Since you're generating a whole new set of data each frame the documentation seems to indicate that GL_STREAM_DRAW is the Right Way to go about things.