Usually, I do this in my current OpenGL ES project (for iOS):


  • Create two VBO's and one IndexBuffer (since I will use the same indices), same size.
  • Create two VAO's and configure them, both bound to the same Index Buffer.

Each frame:

  1. Choose a VBO/VAO couple. (Different from the previous frame, so I'm alternating.)
  2. Bind that VBO
  3. Upload new data using glBufferSubData(GL_ARRAY_BUFFER, ...).
  4. Bind the VAO
  5. Render my stuff using glDrawElements(GL_***, ...);
  6. Unbind the VAO

However, someone told me to avoid uploading data (step 3) and render immediately the new data (step 5). I should avoid this, because the glDrawElements call will stall until the buffer is effectively uploaded to VRAM. So he suggested to draw all my geometry I uploaded the previous frame and upload in the current frame what will be drawn in the next frame. Thus, everything is rendered with the delay of one frame.

Is this true or am I using the good approach to work with streaming vertex data?

(I do know that the pipeline will stall the other way around. Ie: when you draw and immediately try to change the buffer data. But I'm not doing that, since I implemented double buffering.)

  • \$\begingroup\$ What you can do is upload the buffer data as early in the frame as possible, and render the buffer as late in the frame as possible, so that there is some CPU-bound work in between the two operations. This will remove the 1-frame latency and stop wasting time if the GPU takes a while. \$\endgroup\$
    – jmegaffin
    Jul 27, 2013 at 7:42
  • \$\begingroup\$ There's ultimately no way to know, since OpenGL ES runs on an extremely wide variety of hardware. \$\endgroup\$ Jul 27, 2013 at 8:54
  • \$\begingroup\$ @NicolBolas: What do you do in general. This way or not? \$\endgroup\$ Jul 27, 2013 at 10:16

1 Answer 1


Since you've mentioned iOS in your question, I'm going to refer you to Apple's guidelines, particularly at here: Use Double Buffering to Avoid Resource Conflicts.

Note that they comment: "Although shown for textures, this solution works for almost any type of OpenGL ES object".

In OpenGL ES 3.0 you would have glMapBufferRange, which is a better solution for streaming, but in the absence of that I would say to run with Apple's own current guidelines.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .