Re: [PyOpenGL-Users] glDeleteBuffers() and arrays.vbo
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2009-07-25 04:41:06
|
Dan Helfman wrote: > Hi all, > > I may have found a bug in PyOpenGL's arrays.vbo module, but it could be > a problem with my code or system. When a vertex or other buffer is > automatically deleted by PyOpenGL's deleter, here's the error that I get: > > Exception OpenGL.error.NullFunctionError: NullFunctionError('Attempt to > call an undefined function glDeleteBuffers, check for > bool(glDeleteBuffers) before calling',) in <function doBufferDeletion at > 0x0A8892B0> ignored > This sounds like the VBO is getting deleted after module cleanup? You should always have a glDeleteBuffers implementation if you have a glGenBuffers implementation. Basically this code is getting called after the system has done so much cleanup that the functions aren't available any more (at least, that's my interpretation). > To me, that sounds like my OpenGL implementation (from Nvidia) doesn't > implement glDeleteBuffers() for whatever reason. The deleter code in > vbo.py appears to check for this, but it checks for an AttributeError > rather than an OpenGL.error.NullFunctionError, or better yet, doing a > protective bool(glDeleteBuffers) before actually calling glDeleteBuffers(). > That's now fixed in bzr head, will show up in the 3.0.1a2 release. i.e. we catch the NullFunctionError, so you shouldn't see the ignored error messages any more. > By the way, is it problematic that when doing a manual VBO.delete(), the > automatic deleter is still invoked? Shouldn't VBO.delete() pop the > deleter so glDeleteBuffers() isn't called twice for a particular VBO? Or > is that not a problem? > The auto-deleter uses the same list (self.buffers of the vbo), so the delete method's pop() from that list meant there was nothing left in the auto-deleter. It shouldn't be possible for the deleter to get called before the delete method, but just in case I've altered it to also use pop() to retrieve values (rather than simple iteration). Calling glDeleteBuffers() twice for the same buffer would be a problem if, for instance, another vbo had already been allocated that ID. That said, you *shouldn't* ever need to explicitly call delete on the VBO instance unless for some reason you want to "reuse" the VBO object but not the GL-side buffer (I can't think of a real use-case for that). Thanks for the bug report, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |