<p><a href="https://www.opengl.org/wiki/OpenGL_Object#Object_Creation_and_Destruction" rel="nofollow noreferrer">Deleting an OpenGL object</a> is merely a suggestion. Deleting an object will unbind the object from any binding point it is currently bound to. However, buffer objects are not "bound" to VAOs. They are <em>attached</em> to VAOs.</p>

<p>When you call <code>glVertexAttrib*Pointer</code>, you attach a buffer object to the VAO. The buffer object to be attached is the one bound to <code>GL_ARRAY_BUFFER</code>. Unbinding that buffer, or even flat-out deleting it, will <em>not</em> undo the attachment.</p>

<p>And an OpenGL object <a href="https://www.opengl.org/wiki/OpenGL_Object#Deletion_orphaning" rel="nofollow noreferrer">will continue to exist so long as it is <em>attached</em> to a container object</a>.</p>

CC BY-SA 3.0
2016-12-16T16:23:32.423Z
2016-12-16T16:23:32.423Z
Nicol Bolas
<p>After calling <code>glVertexAttribPointer</code> to associate data of the currently bound vertex array with data from the currently bound <code>GL_ARRAY_BUFFER</code>, I mentioned that I can simply delete the used buffer without it affecting the rendering.</p>

<p>What actually happens with the data within the buffer when calling <code>glVertexAttribPointer</code>? It seems like the data from the buffer actually get's copied into another memory location that the vertex array uses.</p>

<opengl><vertex-buffer-object>
OpenGL VertexArray Data "Retention"?
salbeira
# OpenGL VertexArray Data "Retention"?

(Asked by: username_0 on 2016-12-15)

After calling `glVertexAttribPointer` to associate data of the currently bound vertex array with data from the currently bound `GL_ARRAY_BUFFER`, I mentioned that I can simply delete the used buffer without it affecting the rendering.

What actually happens with the data within the buffer when calling `glVertexAttribPointer`? It seems like the data from the buffer actually get's copied into another memory location that the vertex array uses.

**Tags:** opengl, vertex-buffer-object


---

## 1 answers

### Answer by username_1 on 2016-12-16. Score: 5

[Deleting an OpenGL object](https://www.opengl.org/wiki/OpenGL_Object#Object_Creation_and_Destruction) is merely a suggestion. Deleting an object will unbind the object from any binding point it is currently bound to. However, buffer objects are not "bound" to VAOs. They are *attached* to VAOs.

When you call `glVertexAttrib*Pointer`, you attach a buffer object to the VAO. The buffer object to be attached is the one bound to `GL_ARRAY_BUFFER`. Unbinding that buffer, or even flat-out deleting it, will *not* undo the attachment.

And an OpenGL object [will continue to exist so long as it is *attached* to a container object](https://www.opengl.org/wiki/OpenGL_Object#Deletion_orphaning).


---

