I\'m having a bit of performance issue in my iOS/Android game where several VBO\'s have to be updated every once in a while. After profiling my game it turns out that glDele
glGenBuffers
and glDeleteBuffers
are designed to only be run on initialization and cleanup, respectively. Calling them during runtime is bad.
glBufferData
replaces the current buffer data with a new set of data, which automatically changes the size of the buffer. You can safely remove the whole glGenBuffers
/glDeleteBuffers
thing and move it into initialization and cleanup.
Additionally, you are creating the buffer as a static buffer. This is telling OpenGL that you will almost never change it so it stores it in a way that's quicker to access on the GPU but slower to access from the rest of the system. Try changing GL_STATIC_DRAW
to GL_DYNAMIC_DRAW
or GL_STREAM_DRAW
. More on this here: http://www.opengl.org/wiki/Buffer_Objects#Buffer_Object_Usage