OpenGL_accelerate.arraydatatype
Cython-coded Array-handling accelerator module
Classes
class ArrayDatatype(
object
):
Mix-in for array datatype classes
The ArrayDatatype marker essentially is used to mark a particular argument
as having an "array" type, which means that it is eligible for handling
via the arrays sub-package and its registered handlers.
__call__
We cannot simply reference from_param as under Python 2.7 that makes us non-callable
__init__
Initialize, grabbing our handler registry
arrayByteCount
Given a data-value, try to determine number of bytes it's final form occupies
For most data-types this is arraySize() * atomic-unit-size
arraySize
Given a data-value, calculate dimensions for the array (number-of-units)
arrayToGLType
Given a data-value, guess the OpenGL type of the corresponding pointer
Note: this is not currently used in PyOpenGL and may be removed
eventually.
asArray
Given a value, convert to preferred array representation
baseType
dataPointer
Given a value in a known data-pointer type, return long for pointer
dimensions
Given a data-value, get the dimensions (assumes full structure info)
from_param
Given a value in a known data-pointer type, convert to a ctypes pointer
getHandler
Retrieve FormatHandler for given value
This method is replaced by the FormatHandler registry
once the registry is initialized...
getRegistry
Get our handler registry
returnHandler
Get the default return-handler
typeConstant
typedPointer
Return a pointer-to-base-type pointer for given value
unitSize
Determine unit size of an array (if possible)
Uses our local type if defined, otherwise asks the handler to guess...
voidDataPointer
Given value in a known data-pointer type, return void_p for pointer
zeros
Allocate a return array of the given dimensions filled with zeros
class AsArrayOfType(
pyArgConverter
):
Given arrayName and typeName coerce arrayName to array of type typeName
TODO: It should be possible to drop this if ERROR_ON_COPY,
as array inputs always have to be the final objects in that
case.
__init__
x.__init__(...) initializes x; see help(type(x)) for signature
arrayName
arrayType
finalise
typeName
class AsArrayTyped(
pyArgConverter
):
Given arrayName and arrayType, convert arrayName to array of type
TODO: It should be possible to drop this if ERROR_ON_COPY,
as array inputs always have to be the final objects in that
case.
__init__
x.__init__(...) initializes x; see help(type(x)) for signature
arrayName
arrayType
finalise
Finalize the wrapper (nothing to do here)
class AsArrayTypedSize(
cArgConverter
):
class AsArrayTypedSizeChecked(
AsArrayTyped
):
class HandlerRegistry(
object
):
C-coded registry of format handlers for array data-formats
__call__
x.__call__(...) <==> x(...)
__delitem__
x.__delitem__(y) <==> del x[y]
__init__
x.__init__(...) initializes x; see help(type(x)) for signature
__setitem__
x.__setitem__(i, y) <==> x[i]=y
register
Register this class as handler for given set of types
registerReturn
Register this handler as the default return-type handler
class Output(
cArgConverter
):
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.
__init__
x.__init__(...) initializes x; see help(type(x)) for signature
finalise
oldStyleReturn
Retrieve cArgs[ self.index ]
class OutputOrInput(
Output
):
class SizedOutput(
Output
):
Output class that looks up output size via a callable function
- specifier
- Python argument name used to lookup the data-size
- lookup
- function taking argument in specifier to determine size
__init__
x.__init__(...) initializes x; see help(type(x)) for signature
finalise
class SizedOutputOrInput(
SizedOutput
):