2
votes

I was wondering how to delete a vertex buffer object correctly in python. I generate my VBOs like this:

from ctypes import pointer
vbo_id = GLuint()
glGenBuffers(1, pointer(vbo_id))

From time to time I have to delete a VBO and create a new one instead. I was wondering what the correct way of deleting the VBO is? I've tried the following two ways but I don't know which one is correct (and python doesn't complain either way):

glDeleteBuffers(1, pointer(vbo_id))
or 
glDeleteBuffers(1, vbo_id)

Which call is correct? And does deleting the VBO also free the memory on the GPU?

1
seems like both ways are correct, since calling glIsBuffer(vbo_id) returns 0 in either case. - memyself

1 Answers

3
votes

I don't write Python, so take it with that grain of salt, but the specification for glDeleteBuffers() takes a number of buffers and an array of buffer names. So it should probably be pointer(vbo_id). In C, it's the same as glGenBuffers(), so I'd assume the same thing in Python. The reason being that the second parameter is an array of buffer names, not just a buffer name.