OpenGL.converters
Implementations for common converter types
Classes
class CallFuncPyConverter(
PyConverter
):
Converter sub-class for use in Wrapper.cConverters
This class just defines the interface for a cConverter-style
Converter object
Base class for Converter types
Converter objects are callable objects used with the
OpenGL.wrapper.Wrapper class to simplify the wrapping
of functions by collecting commonly used functionality
into a reusable function.
Each Converter has two (class) attributes:
- argNames
- list of argument names for initialisation
- indexLookups
- set of (indexname, argName,methodName) values to lookup on wrapper. These allow us to use argument-name references to refer to which arguments to use when processing (prevents the need to revise pointers when we change the API for a function).
Converters can be any of the Wrapper API helper functions,
so the callable interface can vary among Converter classes.
NULL or Default CConverter, returns same-named Python argument
Used primarily to allow for specifying a converter that explicitly
says "use the default behaviour". This is *not* a finalise-ing
converter, it is passed in the index explicitly and just retrieves
that index from pyArgs when called.
Raises informative errors if the index cannot be resolved in pyArgs
CConverter returning named Python argument
Intended for use in cConverters, the function returned
retrieves the named pyArg and returns it when called.
index
name
CConverter generating static-size typed output arrays
Produces an output array of given type (arrayType) and
size using self.lookup() to determine the size of the
array to be produced, where the lookup function is passed
as an initialisation argument.
Provides also:
oldStyleReturn( ... ) for use in the default case of
PyOpenGL compatability mode, where result arrays of
size (1,) are returned as scalar values.
arrayType
index
inIndex
outIndex
size
Converter sub-class for use in Wrapper.pyConverters
This class just defines the interface for a pyConverter-style
Converter object
Converter sub-class for use as Wrapper.returnValues
This class just defines the interface for a returnValues-style
Converter object
Output generating dynamically-sized typed output arrays
Takes an extra parameter "specifier", which is the name of
a Python argument to be passed to the lookup function in order
to determine the appropriate size for the output array.
arrayType
index
lookup
specifier
CConverter for processing array-of-pointers-to-strings data-type
Converter is a CConverter for the array-of-lengths for a
array-of-pointers-to-strings data-type used to pass a set
of code fragments to the GLSL compiler.
Provides also:
- stringArray
- PyConverter callable ensuring list-of-strings format for the python argument
- stringArrayForC
- CResolver converting the array to POINTER(c_char_p) format for passing to C
- totalCount
- CConverter callable giving count of string pointers (that is, length of the pointer array)
totalCount(
self
,
pyArgs
,
index
,
baseOperation
)
Get array of length integers for string contents