| |
- FormatHandler(object)
-
- VBOHandler
- object
-
- Implementation
- VBO
class Implementation(object) |
|
Abstraction point for the various implementations that can be used |
|
Methods defined here:
- __init__(self)
- __nonzero__(self)
- basename(self, name)
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:
- available = False
|
class VBO(object) |
|
Instances can be passed into array-handling routines
You can check for whether VBOs are supported by accessing the implementation
attribute of the VBO, which will raise a RuntimeError if there is no available
implementation. |
|
Methods defined here:
- __getattr__(self, key)
- __init__(self, data, usage='GL_DYNAMIC_DRAW', target='GL_ARRAY_BUFFER')
- __len__(self)
- __setitem__(self, slice, array)
- Set slice of data on the array and vbo (if copied already)
slice -- the Python slice object determining how the data should
be copied into the vbo/array
array -- something array-compatible that will be used as the
source of the data, note that the data-format will have to
be the same as the internal data-array to work properly, if
not, the amount of data copied will be wrong.
This is a reasonably complex operation, it has to have all sorts
of state-aware changes to correctly map the source into the low-level
OpenGL view of the buffer (which is just bytes as far as the GL
is concerned).
- bind(self)
- Bind this buffer for use in vertex calls
- copy_data(self)
- Copy our data into the buffer on the GL side
- create_buffers(self)
- Create the internal buffer(s)
- delete(self)
- Delete this buffer explicitly
- resolve(self, value)
- Resolve string constant to constant
- set_array(self, data)
- Update our entire array with new data
- unbind(self)
- Unbind the buffer (make normal array operations active)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- implementation
- Retrieve the appropriate implementation for this machine
Data and other attributes defined here:
- copied = False
|
class VBOHandler(FormatHandler) |
|
Handles VBO instances passed in as array data |
|
- Method resolution order:
- VBOHandler
- FormatHandler
- object
Methods defined here:
- 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)
- Given a value, convert to array representation
- dataPointer(self, instance)
- Retrieve data-pointer from the instance's data
Is always NULL, to indicate use of the bound pointer
- dimensions(self, value, typeCode=None)
- Determine dimensions of the passed array value (if possible)
- from_param(self, instance)
- ones = zeros(self, dims, typeCode)
- unitSize(self, value, typeCode=None)
- Determine unit size of an array (if possible)
- zeros(self, dims, typeCode)
- Not implemented
Methods inherited from FormatHandler:
- register(self, types=None)
- Register this class as handler for given set of types
- registerEquivalent(self, typ, base)
- Register a sub-class for handling as the base-type
- registerReturn(self)
- Register this handler as the default return-type handler
Class methods inherited from FormatHandler:
- chooseOutput(cls, preferred=None) from type
- Choose our output-capable plugin
- 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 = [<OpenGL.arrays.nones.NoneHandler object at 0x8ee5e8c>, <OpenGL.arrays.strings.StringHandler object at 0x8ee5eac>, <OpenGL.arrays.lists.ListHandler object at 0x8ee5ecc>, <OpenGL.arrays.numbers.NumberHandler object at 0x8ee5eec>, <OpenGL.arrays.ctypesarrays.CtypesArrayHandler object at 0x8ee5f0c>, <OpenGL.arrays.ctypesparameters.CtypesParameterHandler object at 0x8ee5f2c>, <OpenGL.arrays.ctypespointers.CtypesPointerHandler object at 0x8ee5f4c>, <OpenGL.arrays.nones.NoneHandler object at 0x8ee5f6c>, <OpenGL.arrays.strings.StringHandler object at 0x8ee5f8c>, <OpenGL.arrays.lists.ListHandler object at 0x8ee5fcc>, <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <OpenGL.arrays.ctypesarrays.CtypesArrayHandler object at 0x852714c>, <OpenGL.arrays.ctypesparameters.CtypesParameterHandler object at 0x852702c>, <OpenGL.arrays.ctypespointers.CtypesPointerHandler object at 0x852704c>]
- GENERIC_OUTPUT_PREFERENCES = ['numpy', 'numeric', 'ctypesarrays']
- HANDLED_TYPES = ()
- HANDLER_REGISTRY = {'ctypesarray': <OpenGL.arrays.ctypesarrays.CtypesArrayHandler object at 0x852714c>, 'ctypesparameter': <OpenGL.arrays.ctypesparameters.CtypesParameterHandler object at 0x852702c>, 'ctypespointer': <OpenGL.arrays.ctypespointers.CtypesPointerHandler object at 0x852704c>, 'list': <OpenGL.arrays.lists.ListHandler object at 0x8ee5fcc>, 'none': <OpenGL.arrays.nones.NoneHandler object at 0x8ee5f6c>, 'numbers': <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, 'str': <OpenGL.arrays.strings.StringHandler object at 0x8ee5f8c>}
- LAZY_TYPE_REGISTRY = {}
- TYPE_REGISTRY = {<type 'float'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <type 'int'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <type 'list'>: <OpenGL.arrays.lists.ListHandler object at 0x8ee5fcc>, <type 'long'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <type 'NoneType'>: <OpenGL.arrays.nones.NoneHandler object at 0x8ee5f6c>, <type 'str'>: <OpenGL.arrays.strings.StringHandler object at 0x8ee5f8c>, <type 'tuple'>: <OpenGL.arrays.lists.ListHandler object at 0x8ee5fcc>, <class 'ctypes.c_long'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <class 'ctypes.c_ulong'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, <class 'ctypes.c_float'>: <OpenGL.arrays.numbers.NumberHandler object at 0x85271cc>, ...}
- baseType = None
- preferredOutput = None
- typeConstant = None
| |