# Module pyglet.graphics.vertexdomain

Manage related vertex attributes within a single vertex domain.

A vertex "domain" consists of a set of attribute descriptions that together describe the layout of one or more vertex buffers which are used together to specify the vertices in a primitive. Additionally, the domain manages the buffers used to store the data and will resize them as necessary to accommodate new vertices.

Domains can optionally be indexed, in which case they also manage a buffer containing vertex indices. This buffer is grown separately and has no size relation to the attribute buffers.

Applications can create vertices (and optionally, indices) within a domain with the VertexDomain.create method. This returns a VertexList representing the list of vertices created. The vertex attribute data within the group can be modified, and the changes will be made to the underlying buffers automatically.

The entire domain can be efficiently drawn in one step with the VertexDomain.draw method, assuming all the vertices comprise primitives of the same OpenGL primitive mode.

## Classes

| VertexDomain Management of a set of vertex lists.
| VertexList A list of vertices within a VertexDomain.
| IndexedVertexDomain Management of a set of indexed vertex lists.
| IndexedVertexList A list of vertices within an IndexedVertexDomain that are indexed.

## Functions

| create_attribute_usage(format) Create an attribute and usage pair from a format string.
VertexDomain | create_domain(*attribute_usage_formats) Create a vertex domain covering the given attribute usage formats.
VertexDomain | create_indexed_domain(*attribute_usage_formats) Create an indexed vertex domain covering the given attribute usage formats.

## Variables

| __package__ = ``'``pyglet.graphics``'``

## Function Details

### create_attribute_usage

create_attribute_usage(format)

Create an attribute and usage pair from a format string. The format string is as documented in pyglet.graphics.vertexattribute, with the addition of an optional usage component:

    usage ::= attribute ( '/' ('static' | 'dynamic' | 'stream' | 'none') )?

If the usage is not given it defaults to 'dynamic'. The usage corresponds to the OpenGL VBO usage hint, and for `static` also indicates a preference for interleaved arrays. If `none` is specified a buffer object is not created, and vertex data is stored in system memory.

Some examples:

`v3f/stream`
  3D vertex position using floats, for stream usage
`c4b/static`
  4-byte color attribute, for static usage

Returns:
  attribute, usage

### create_domain

create_domain(*attribute_usage_formats)
Create a vertex domain covering the given attribute usage formats. See documentation for create_attribute_usage and pyglet.graphics.vertexattribute.create_attribute for the grammar of these format strings.

Returns: VertexDomain

### create_indexed_domain

create_indexed_domain(*attribute_usage_formats)
Create an indexed vertex domain covering the given attribute usage formats. See documentation for create_attribute_usage and pyglet.graphics.vertexattribute.create_attribute for the grammar of these format strings.

Returns: VertexDomain