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

Numbers passed as array handling code for PyOpenGL

 
Modules
       
OpenGL.constants
ctypes
OpenGL.arrays.formathandler

 
Classes
       
FormatHandler(object)
NumberHandler

 
class NumberHandler(FormatHandler)
    Allows the user to pass a bald Python float,int, etceteras as an array-of-1
 
 
Method resolution order:
NumberHandler
FormatHandler
object

Methods defined here:
arraySize(self, value, typeCode=None)
Given a data-value, calculate ravelled size 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
dataPointer = from_param(self, value, typeCode=None)
from_param(self, value, typeCode=None)
If it's a ctypes value, pass on, otherwise do asArray
ones(self, dims, typeCode=None)
Currently don't allow Number as output types!
registerEquivalent(self, typ, base)
Register a sub-class for handling as the base-type
unitSize(self, value, typeCode=None)
Determine unit size of an array (if possible)
zeros(self, dims, typeCode=None)
Currently don't allow Number as output types!

Data and other attributes defined here:
HANDLED_TYPES = (<type 'int'>, <type 'long'>, <type 'float'>, <class 'ctypes.c_double'>, <class 'ctypes.c_float'>, <class 'ctypes.c_int'>, <class 'ctypes.c_short'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_ushort'>, <class 'ctypes.c_float'>, <class 'ctypes.c_double'>)

Methods inherited from FormatHandler:
dimensions(self, value, typeCode=None)
Determine dimensions of the passed array value (if possible)
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
isOutput = False
preferredOutput = None
typeConstant = None

 
Data
        BYTE_SIZES = {GL_BYTE: 1, GL_UNSIGNED_BYTE: 1, GL_SHORT: 2, GL_UNSIGNED_SHORT: 2, GL_INT: 4, GL_UNSIGNED_INT: 4, GL_FLOAT: 4, GL_DOUBLE: 8}
CONSTANT_TO_TYPE = {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'>}
DEFAULT_TYPES = {<type 'float'>: (<class 'ctypes.c_double'>, GL_DOUBLE), <type 'int'>: (<class 'ctypes.c_int'>, GL_INT), <type 'long'>: (<class 'ctypes.c_int'>, GL_INT)}
REGISTRY_NAME = 'numbers'
TARGET_TYPES = {<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}
TARGET_TYPE_TUPLE = (<class 'ctypes.c_double'>, <class 'ctypes.c_float'>, <class 'ctypes.c_float'>, <class 'ctypes.c_double'>, <class 'ctypes.c_byte'>, <class 'ctypes.c_short'>, <class 'ctypes.c_int'>, <class 'ctypes.c_ubyte'>, <class 'ctypes.c_ushort'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>)
__file__ = '/home/mcfletch/pylive/OpenGL/arrays/numbers.pyc'
__name__ = 'OpenGL.arrays.numbers'
__package__ = 'OpenGL.arrays'