OpenGL.arrays.ctypesarrays
index
/home/mcfletch/pylive/OpenGL/arrays/ctypesarrays.py

ctypes sized data-arrays as a data-formatmechanism
 
XXX we have to use _ctypes.Array as the type descriminator,
would be nice to have it available from the public module

 
Modules
       
_ctypes
OpenGL.constant
OpenGL.constants
ctypes
OpenGL.arrays.formathandler
operator

 
Classes
       
FormatHandler(object)
CtypesArrayHandler

 
class CtypesArrayHandler(FormatHandler)
    Ctypes Array-type-specific data-type handler for OpenGL
 
 
Method resolution order:
CtypesArrayHandler
FormatHandler
object

Methods defined here:
arrayByteCount(self, value, typeCode=None)
Given a data-value, calculate number of bytes required to represent
arraySize(self, value, typeCode=None)
Given a data-value, calculate dimensions for the array
arrayToGLType(self, value)
Given a value, guess OpenGL type of the corresponding pointer
asArray(self, value, typeCode=None)
Convert given value to an array value of given typeCode
dimensions(self, value, typeCode=None)
Determine dimensions of the passed array value (if possible)
dims(self, value)
Produce iterable of all dimensions
ones(self, dims, typeCode='d')
Return numpy array of ones in given size
types(self, value)
Produce iterable producing all composite types
unitSize(self, value, typeCode=None)
Determine unit size of an array (if possible)
voidDataPointer(cls, value)
Given value in a known data-pointer type, return void_p for pointer
zeros(self, dims, typeCode)
Return Numpy array of zeros in given size

Class methods defined here:
from_param(cls, value, typeCode=None) from type

Static methods defined here:
dataPointer = addressof(...)
addressof(C instance) -> integer
Return the address of the C instance internal buffer

Data and other attributes defined here:
HANDLED_TYPES = (<type '_ctypes.Array'>,)
isOutput = True

Methods inherited from FormatHandler:
register(self, types=None)
Register this class as handler for given set of types
registerReturn(self)
Register this handler as the default return-type handler

Class methods inherited from FormatHandler:
loadAll(cls) from type
Load all setuptools-registered FormatHandler classes
 
register a new datatype with code similar to this in your
package's setup.py for setuptools:
 
entry_points = {
    'OpenGL.arrays.formathandler':[
        'numpy = OpenGL.arrays.numpymodule.NumpyHandler',
    ],
}
loadPlugin(cls, entrypoint) from type
Load a single entry-point via plugins module
typeLookup(cls, type) from type
Lookup handler by data-type

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

Data and other attributes inherited from FormatHandler:
ALL_OUTPUT_HANDLERS = []
GENERIC_OUTPUT_PREFERENCES = ['numpy', 'numeric', 'ctypesarrays']
HANDLER_REGISTRY = {}
LAZY_TYPE_REGISTRY = {}
baseType = None
preferredOutput = None
typeConstant = None

 
Data
        ARRAY_TO_GL_TYPE_MAPPING = {<class 'ctypes.c_short'>: GL_SHORT, <class 'ctypes.c_ushort'>: GL_UNSIGNED_SHORT, <class 'ctypes.c_int'>: GL_INT, <class 'ctypes.c_uint'>: GL_UNSIGNED_INT, <class 'ctypes.c_float'>: GL_FLOAT, <class 'ctypes.c_double'>: GL_DOUBLE, <class 'ctypes.c_ubyte'>: GL_UNSIGNED_BYTE, <class 'ctypes.c_byte'>: GL_BYTE, <class 'ctypes.c_char'>: <type 'str'>}
GL_TYPE_TO_ARRAY_MAPPING = {GL_BYTE: <class 'ctypes.c_byte'>, GL_UNSIGNED_BYTE: <class 'ctypes.c_ubyte'>, GL_SHORT: <class 'ctypes.c_short'>, GL_UNSIGNED_SHORT: <class 'ctypes.c_ushort'>, GL_INT: <class 'ctypes.c_int'>, GL_UNSIGNED_INT: <class 'ctypes.c_uint'>, GL_FLOAT: <class 'ctypes.c_float'>, GL_DOUBLE: <class 'ctypes.c_double'>, <type 'str'>: <class 'ctypes.c_char'>}
REGISTRY_NAME = 'ctypesarrays'
__file__ = '/home/mcfletch/pylive/OpenGL/arrays/ctypesarrays.pyc'
__name__ = 'OpenGL.arrays.ctypesarrays'
__package__ = 'OpenGL.arrays'