Class pyglet.graphics.vertexbuffer.IndirectArrayRegion

AbstractBufferRegion --+
                       |
                      IndirectArrayRegion

A mapped region in which data elements are not necessarily contiguous.

This region class is used to wrap buffer regions in which the data must be accessed with some stride. For example, in an interleaved buffer this region can be used to access a single interleaved component as if the data was contiguous.

Methods

  __init__(self, region, size, component_count, component_stride)
Wrap a buffer region.
  __repr__(self)
  __getitem__(self, index)
  __setitem__(self, index, value)
  invalidate(self)
Mark this region as changed.

Instance Variables

ctypes array array
Array of data, of the type and count requested by get_region.
(Inherited from pyglet.graphics.vertexbuffer.AbstractBufferRegion)

Method Details

__init__

(Constructor) __init__(self, region, size, component_count, component_stride)

Wrap a buffer region.

Use the component_count and component_stride parameters to specify the data layout of the encapsulated region. For example, if RGBA data is to be accessed as if it were packed RGB, component_count would be set to 3 and component_stride to 4. If the region contains 10 RGBA tuples, the size parameter is 3 * 10 = 30.

Parameters:
region : AbstractBufferRegion
The region with interleaved data
size : int
The number of elements that this region will provide access to.
component_count : int
The number of elements that are contiguous before some must be skipped.
component_stride : int
The number of elements of interleaved data separating the contiguous sections.

invalidate

invalidate(self)

Mark this region as changed.

The buffer may not be updated with the latest contents of the array until this method is called. (However, it may not be updated until the next time the buffer is used, for efficiency).

Overrides:
AbstractBufferRegion.invalidate