Class pyglet.graphics.vertexattribute.AbstractAttribute

Known Subclasses:
ColorAttribute, EdgeFlagAttribute, FogCoordAttribute, GenericAttribute, NormalAttribute, SecondaryColorAttribute, TexCoordAttribute, VertexAttribute
Abstract accessor for an attribute in a mapped buffer.

Methods

  __init__(self, count, gl_type)
Create the attribute accessor.
  enable(self)
Enable the attribute using glEnableClientState.
  set_pointer(self, offset)
Setup this attribute to point to the currently bound buffer at the given offset.
AbstractBufferRegion get_region(self, buffer, start, count)
Map a buffer region using this attribute as an accessor.
  set_region(self, buffer, start, count, data)
Set the data over a region of the buffer.

Method Details

__init__

(Constructor) __init__(self, count, gl_type)
Create the attribute accessor.
Parameters:
count : int
Number of components in the attribute.
gl_type : int
OpenGL type enumerant; for example, GL_FLOAT

set_pointer

set_pointer(self, offset)

Setup this attribute to point to the currently bound buffer at the given offset.

offset should be based on the currently bound buffer's ptr member.

Parameters:
offset : int
Pointer offset to the currently bound buffer for this attribute.

get_region

get_region(self, buffer, start, count)

Map a buffer region using this attribute as an accessor.

The returned region can be modified as if the buffer was a contiguous array of this attribute (though it may actually be interleaved or otherwise non-contiguous).

The returned region consists of a contiguous array of component data elements. For example, if this attribute uses 3 floats per vertex, and the count parameter is 4, the number of floats mapped will be 3 * 4 = 12.

Parameters:
buffer : AbstractMappable
The buffer to map.
start : int
Offset of the first vertex to map.
count : int
Number of vertices to map
Returns: AbstractBufferRegion

set_region

set_region(self, buffer, start, count, data)
Set the data over a region of the buffer.
Parameters:
buffer : AbstractMappable`
The buffer to modify.
start : int
Offset of the first vertex to set.
count : int
Number of vertices to set.
data : sequence
Sequence of data components.