# Class pyglet.graphics.vertexbuffer.MappableVertexBufferObject

    AbstractBuffer --+
                     |
    VertexBufferObject --+
                         |
      AbstractMappable --+
                         |
                        MappableVertexBufferObject

A VBO with system-memory backed store.

Updates to the data via set_data, set_data_region and map will be held in local memory until bind is called. The advantage is that fewer OpenGL calls are needed, increasing performance.

There may also be less performance penalty for resizing this buffer.

Updates to data via map are committed immediately.

## Methods

| __init__(self, size, target, usage)
| bind(self)
| set_data(self, data)
| set_data_region(self, data, start, length)
| map(self, invalidate=False)
| unmap(self)
AbstractBufferRegion | get_region(self, start, size, ptr_type) Map a region of the buffer into a ctypes array of the desired type.
| resize(self, size)
| __del__(self) (Inherited from pyglet.graphics.vertexbuffer.VertexBufferObject)
| delete(self) Delete this buffer, reducing system resource usage. (Inherited from pyglet.graphics.vertexbuffer.VertexBufferObject)
| unbind(self) Reset the buffer's OpenGL target. (Inherited from pyglet.graphics.vertexbuffer.VertexBufferObject)

## Instance Variables

int | ptr = `0` Memory offset of the buffer, as used by the `glVertexPointer` family of functions (Inherited from pyglet.graphics.vertexbuffer.AbstractBuffer)
int | size = `0` Size of buffer, in bytes (Inherited from pyglet.graphics.vertexbuffer.AbstractBuffer)
int | target OpenGL buffer target, for example `GL_ARRAY_BUFFER` (Inherited from pyglet.graphics.vertexbuffer.AbstractBuffer)
int | usage OpenGL buffer usage, for example `GL_DYNAMIC_DRAW` (Inherited from pyglet.graphics.vertexbuffer.AbstractBuffer)

## Method Details

### __init__

(Constructor) __init__(self, size, target, usage)

Overrides:
  VertexBufferObject.__init__

### bind

bind(self)

Overrides:
  VertexBufferObject.bind

### set_data

set_data(self, data)

Overrides:
  VertexBufferObject.set_data

### set_data_region

set_data_region(self, data, start, length)

Overrides:
  VertexBufferObject.set_data_region

### map

map(self, invalidate=False)

Overrides:
  VertexBufferObject.map

### unmap

unmap(self)

Overrides:
  VertexBufferObject.unmap

### 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.

Returns: AbstractBufferRegion
Overrides:
  AbstractMappable.get_region

### resize

resize(self, size)

Overrides:
  VertexBufferObject.resize