/usr/share/pyshared/OpenGL/GLU/quadrics.py is in python-opengl 3.0.1~b2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """Wrapper/Implementation of the GLU quadrics object for PyOpenGL"""
from OpenGL.raw import GLU as simple
from OpenGL.platform import GLU,createBaseFunction, PLATFORM
import ctypes
class GLUQuadric( simple.GLUquadric ):
"""Implementation class for GLUQuadric classes in PyOpenGL"""
FUNCTION_TYPE = PLATFORM.functionTypeFor(PLATFORM.GLU)
CALLBACK_TYPES = {
# mapping from "which" GLU enumeration to a ctypes function type
simple.GLU_ERROR : FUNCTION_TYPE( None, simple.GLenum )
}
def addCallback( self, which, function ):
"""Register a callback for the quadric object
At the moment only GLU_ERROR is supported by OpenGL, but
we allow for the possibility of more callbacks in the future...
"""
callbackType = self.CALLBACK_TYPES.get( which )
if not callbackType:
raise ValueError(
"""Don't have a registered callback type for %r"""%(
which,
)
)
if not isinstance( function, callbackType ):
cCallback = callbackType( function )
else:
cCallback = function
GLU.gluQuadricCallback( self, which, cCallback )
# XXX catch errors!
if getattr( self, 'callbacks', None ) is None:
self.callbacks = {}
self.callbacks[ which ] = cCallback
return cCallback
GLUquadric = GLUQuadric
def gluQuadricCallback( quadric, which=simple.GLU_ERROR, function=None ):
"""Set the GLU error callback function"""
return quadric.addCallback( which, function )
# Override to produce instances of the sub-class...
gluNewQuadric = createBaseFunction(
'gluNewQuadric', dll=GLU, resultType=ctypes.POINTER(GLUQuadric),
argTypes=[],
doc="""gluNewQuadric( ) -> GLUQuadric
Create a new GLUQuadric object""",
argNames=[],
)
__all__ = (
'gluNewQuadric',
'gluQuadricCallback',
'GLUQuadric',
)
|