Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenGL (ES 2.0 but not specific to ES): is GL_STATIC_DRAW meant for use with glBufferData?
    primarykey
    data
    text
    <p>The application I am concerned with right now is a 3d model viewer. The user will very occasionally load in a large new mesh to render, and the old mesh can, should (must) be thrown away. </p> <p>Because of this, <code>GL_STATIC_DRAW</code> is clearly the right hint for the VBO. </p> <p>What I'm a little unsure of at this point is whether to <code>glDeleteBuffers()</code> my VBO and IBO, also <code>glDeleteVertexArrays[OES]()</code> my VAO, or do none of those and just <code>glBufferData()</code> the VBO and IBO with my newly loaded mesh without having to delete and re-gen anything <em>or</em> re-define <code>glVertexAttribPointer</code> VAO state. (Sub-question: If I only delete my VBO and then re-gen it, but I leave my VAO intact, can I still skip <code>glVertexAttribPointer()</code>?)</p> <p>If indeed OpenGL will discard the previous data in the VBO if I call <code>glBufferData()</code>, then this is perfect. As far as I've read <code>glBufferData()</code> is supposed to reallocate the VBO.</p> <p>But really, what I'm looking for is a concrete explanation of what would be different between me re-loading up to the different layers of this onion, and how far up I need to go if all I want is to change my vertex and index buffer content (the raw geometry) in the application, or if there even exists a conceivable situation where one might need to regenerate or delete VBOs at all. I do see that the same VBO might be usefully shared between different sets of VAOs, and I can imagine a situation where you've got some VAO's that you'll never use again so you'd deallocate them, but it seems like the VBOs can just continue to get recycled if there exists the API for you to reallocate the data contained within.</p> <p>I find all of the tutorials and explanations out there only deal with helping you to set stuff up, but now that I've got that stage figured out it's not too clear how to get the rest of these details right.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload