OpenGL.arrays.arrayhelpers
Helper functions for wrapping array-using operations
These are functions intended to be used in wrapping
GL functions that deal with OpenGL array data-types.
Functions
asArrayTypeSize(
typ
,
size
)
Create PyConverter function to get array as type and check size
Produces a raw function, not a PyConverter instance
returnPointer(
result
,
baseOperation
,
pyArgs
,
cArgs
)
Return the converted object as result of function
Note: this is a hack that always returns pyArgs[0]!
setInputArraySizeType(
baseOperation
,
size
,
type
,
argName
= 0
)
Decorate function with vector-handling code for a single argument
if OpenGL.ERROR_ON_COPY is False, then we return the
named argument, converting to the passed array type,
optionally checking that the array matches size.
if OpenGL.ERROR_ON_COPY is True, then we will dramatically
simplify this function, only wrapping if size is True, i.e.
only wrapping if we intend to do a size check on the array.
Classes
class AsArrayOfType(
PyConverter
):
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.
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.
Given arrayName and arrayType, determine size of arrayName
__call__(
self
,
pyArgs
,
index
,
wrappedOperation
)
Get the arg as an array of the appropriate type
Store named pointer value in context indexed by constant
- pointerName
- named pointer argument
- constant
- constant used to index in the context storage
Note: OpenGL.STORE_POINTERS can be set with ERROR_ON_COPY
to ignore this storage operation.
Stores the pyArgs (i.e. result of pyConverters) for the named
pointer argument...