Thread: [PyOpenGL-Users] Using the raw ctypes autogenerated wrappers
Brought to you by:
mcfletch
From: Lorenzo M. <lma...@de...> - 2009-03-23 23:43:40
|
Hi all, the section "Autogenerated wrappers" in the document: http://pyopengl.sourceforge.net/ctypes/development.html states that it is possible to directly import and use the modules in the OpenGL.raw packages, should one want to use the bare ctypes generated wrappers directly. My first approach to do that was replacing imports from OpenGL.GL to imports from OpenGL.raw.GL in my code; all symbols were imported, I could call functions and so on, but every immediate mode operation failed on the call to glEnd, with the error system reporting an unhelpful err 1282 "invalid operation". Puzzled a lot, I started browsing PyOpenGL sources to find out that, if OpenGL.ERROR_CHECKING is True (default, see OpenGL/__init__.py), OpenGL/GL/exceptional.py decorates glBegin/glEnd adding some logic to perform error checking. Setting OpenGL.ERROR_CHECKING = False in my code allows it to run using the raw ctypes wrappers (and get the nice 100% performance boost I was looking for, at the cost of some ctypes pollution in the code), but that looks like a kludge to me: what if one wants error checking with raw wrappers? Is that possible at all? (btw this is on PyOpenGL 3.0.0c1, on Windows XP SP3) Thanks in advance! -- Lorenzo Mancini |