androidopengl-es-2.0vertex-buffer-objects

opengl es2:Advantages of using vertex buffer objects(VBO)


I use glVertexAttribPointer to load my vertex data each frame(~242kb) it takes about 8ms.
Will I gain any performance increase by employing VBO?
I think the answer is NO since I still have to load whole data.
The only way it can get performance gain is if glBufferData loads data faster than glVertexAttribPointer
Is this is the case?


Solution

  • If you have static vertex data then VBO has very clear performance advantage because data is kept in GPU accessible memory.

    When you use glVertexAttribPointer without VBOs driver has to copy your vertex data to GPU accessible memory every frame. There is two reason why client arrays require copy

    1. GPU doesn't have access to all your memory. It can only see pages that GPU driver has mapped to it.
    2. OpenGL promises that you are free to change client array memory after glDraw* returns but GPU rendering happens asynchronously after return.

    VBO data is allocated by driver and mapped to GPU. That avoids copies if you keep same vertex data. Updates also can be optimized if you only update part of vertex array with glBufferSubData. (eg. only update texture coordinates without vertex position update)