OpenGL.wrapper
index
/build/buildd/pyopengl-3.0.0~b6/OpenGL/wrapper.py

The wrapping code for providing natural ctypes-based OpenGL interface

 
Modules
       
OpenGL.converters
ctypes
OpenGL.error
OpenGL.platform

 
Classes
       
object
Wrapper

 
class Wrapper(object)
    Wrapper around a ctypes cFunction object providing SWIG-like hooks
 
Attributes:
 
        wrappedOperation -- base operation, normally a ctypes function 
                with data-types and error-checking specified
        pyConverters -- converters for incoming Python arguments,
                provide 1:1 mapping to incoming Python arguments, can
                suppress an argument from the argument-set as well
                        see setPyConverter
        pyConverterNames -- caching/storage of the argument names 
                for the Python converters 
        cConverters -- converters for incoming C-level arguments
                produce Python-level objects in 1:1 mapping to ctypes
                arguments from pyConverters results
                        see setCConverter
        cResolvers -- converters turning Python-level objects into 
                ctypes-compatible data-types 
                        see setCResolver
 
Generic Attributes:
 
        {ARG1}_LOOKUP_{ARG2} -- lookup dictionaries to provide sizes for 
                ARG1 output value from the value of ARG2, provided for 
                documentation/reference
        {ARG1}_FROM_{ARG2} -- lookup functions to provide sizes for ARG1
                output value from the value of ARG2, provided for 
                documentation/reference
 
  Methods defined here:
__call__(self, *args, **named)
Finalise the wrapper before calling it
__getattr__(self, key)
Delegate attribute lookup to our wrappedOperation
__init__(self, wrappedOperation)
Initialise the wrapper, storing wrappedOperation
__nonzero__(self)
Is this function/wrapper available?
__setattr__(self, key, value)
Forward attribute setting to our wrappedOperation
cArgIndex(self, argName)
Return the C-argument index for the given argument name
finalise(self)
Finalise our various elements into simple index-based operations
finaliseCall(self)
Produce specialised versions of call for finalised wrapper object
 
This returns a version of __call__ that only does that work which is
required by the particular wrapper object
 
This is essentially a huge set of expanded nested functions, very 
inelegant...
pyArgIndex(self, argName)
Return the Python-argument index for the given argument name
setCConverter(self, argName, function)
Set C-argument converter for a given argument
 
argName -- the argument name whose C-compatible representation will 
        be calculated with the passed function.
function -- None (indicating a simple copy), a non-callable object to
        be copied into the result-list itself, or a callable object with 
        the signature:
        
                converter( pyArgs, index, wrappedOperation )
        
        where pyArgs is the set of passed Python arguments, with the 
        pyConverters already applied, index is the index of the C argument 
        and wrappedOperation is the underlying function.
 
C-argument converters are your chance to expand/contract a Python 
argument list (pyArgs) to match the number of arguments expected by
the ctypes baseOperation.  You can't have a "null" C-argument converter,
as *something* has to be passed to the C-level function in the 
parameter.
setCResolver(self, argName, function=<object object at 0x401c8460>)
Set C-argument converter for a given argument
setOutput(self, outArg, size=(1,), pnameArg=None, arrayType=None, oldStyleReturn=True)
Set the given argName to be an output array
 
size -- either a tuple compatible with arrayType.zeros or 
        a function taking pname to produce such a value.
arrayType -- array data-type used to generate the output 
        array using the zeros class method...
pname -- optional argument passed into size function, that 
        is, the name of the argument whose *value* will be passed 
        to the size function, often the name of an input argument 
        to be "sized" to match the output argument.
setPyConverter(self, argName, function=<object object at 0x401c8460>)
Set Python-argument converter for given argument
 
argName -- the argument name which will be coerced to a usable internal
        format using the function provided.
function -- None (indicating a simple copy), NULL (default) to eliminate
        the argument from the Python argument-list, or a callable object with 
        the signature:
        
                converter(arg, wrappedOperation, args)
        
        where arg is the particular argument on which the convert is working,
        wrappedOperation is the underlying wrapper, and args is the set of 
        original Python arguments to the function.
 
Note that you need exactly the same number of pyConverters as Python 
arguments.
setReturnValues(self, function=<object object at 0x401c8460>)
Set the return-of-results function for the whole wrapper
setStoreValues(self, function=<object object at 0x401c8460>)
Set the storage-of-arguments function for the whole wrapper

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
localProperties = ('wrappedOperation', '__file__', 'pyConverters', 'pyConverterNames', 'cConverters', 'cResolvers', 'storeValues', 'returnValues')

 
Functions
       
asList(o)
Convert to a list if not already one
glGetError(...)
wrapper(wrappedOperation)
Create a Wrapper sub-class instance for the given wrappedOperation
 
The purpose of this function is to create a subclass of Wrapper which
has the __doc__ and __name__ of the wrappedOperation so that the instance of
the wrapper will show up as <functionname instance @ address> by default,
and will have the docstring available naturally in pydoc and the like.

 
Data
        NULL = <object object at 0x401c8460>
__file__ = '/build/buildd/pyopengl-3.0.0~b6/OpenGL/wrapper.py'
__name__ = 'OpenGL.wrapper'