Class pyglet.graphics.vertexbuffer.AbstractMappable

Known Subclasses:
MappableVertexBufferObject, VertexArray

Methods

AbstractBufferRegion get_region(self, start, size, ptr_type)
Map a region of the buffer into a ctypes array of the desired type.

Method Details

get_region

get_region(self, start, size, ptr_type)

Map a region of the buffer into a ctypes array of the desired type. This region does not need to be unmapped, but will become invalid if the buffer is resized.

Note that although a pointer type is required, an array is mapped. For example:

get_region(0, ctypes.sizeof(c_int) * 20, ctypes.POINTER(c_int * 20))

will map bytes 0 to 80 of the buffer to an array of 20 ints.

Changes to the array may not be recognised until the region's AbstractBufferRegion.invalidate method is called.

Parameters:
start : int
Offset into the buffer to map from, in bytes
size : int
Size of the buffer region to map, in bytes
ptr_type : ctypes pointer type
Pointer type describing the array format to create
Returns: AbstractBufferRegion