Re: [PyOpenGL-Users] using glGetSynciv
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@vr...> - 2011-05-24 02:56:03
|
On 11-05-23 05:44 PM, Henry Gomersall wrote: ... > That didn't seem to be the problem. > > I've had a bit more of a play. Its seems that the problem is *actually* > the first argument: my_sync is an integer. I can't find the type that it > actually needs as the argument though. I've not idea what GLsync > actually is. > > Cheers, > > Henry Okay, I constructed my own test case so I could see what the problem is. There was a bug in the declaration of GLsync, which was declared to be a c_void_p, it should have been declared as a ctypes.POINTER( structure ). I had thought c_void_p would create an opaque pointer type as a return-type, but apparently ctypes short-circuits it to return an integer. I've checked a fix into bzr, and that should appear in the next release of PyOpenGL. In the meantime, you can patch your copy of PyOpenGL with this: === modified file 'OpenGL/constants.py' --- OpenGL/constants.py 2011-04-12 19:23:44 +0000 +++ OpenGL/constants.py 2011-05-24 02:47:52 +0000 @@ -103,7 +103,9 @@ # GL.ARB.sync extension, GLsync is an opaque pointer to a struct # in the extensions header, basically just a "token" that can be # passed to the various operations... -GLsync = ctypes.c_void_p +class _GLsync( ctypes.Structure ): + """Opaque structure definition to fool ctypes into treating us as a real structure""" +GLsync = ctypes.POINTER( _GLsync ) # ctypes.c_void_p does *not* work as a return type... GLvoidp = ctypes.c_void_p ARRAY_TYPE_TO_CONSTANT = [ HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |