When is it safe to delete a OpenGL buffer?

Started by pdid, January 27, 2017, 00:06:29

Previous topic - Next topic

pdid

Currently I am deleting a element buffer after storing data in it and then using it to store data in a VAO attribute 'slot' (glVertexAttribPointer()). This leads to a JVM crash from the native code when I attempt to draw using the VAO. Do I need to take some other step, like waiting until the VAO is unbound, or until the VAO is deleted in order to solve this problem? To my understanding, when the method glVertexAttribPointer() is called, the data in the currently bound array buffer is copied to the VAO attribute 'slot', which would mean the VBO would be safe to delete, however it seems this is not the case. If anyone could explain what my issue is, that would help greatly. Thanks in advance.

Fred

I have the exact same question, so if anyone could help us that would be great.

spasi

The glVertexAttribPointer() does not copy anything, it simply stores the data pointer. The buffer containing the data (whether a VBO or a client buffer) must remain live until rendering has finished.