5
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

Deleting an OpenGL object 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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.