Class pyglet.graphics.vertexbuffer.AbstractBuffer

Known Subclasses:
VertexBufferObject, VertexArray
Abstract buffer of byte data.

Methods

  bind(self)
Bind this buffer to its OpenGL target.
  unbind(self)
Reset the buffer's OpenGL target.
  set_data(self, data)
Set the entire contents of the buffer.
  set_data_region(self, data, start, length)
Set part of the buffer contents.
POINTER(ctypes.c_ubyte) map(self, invalidate=False)
Map the entire buffer into system memory.
  unmap(self)
Unmap a previously mapped memory block.
  resize(self, size)
Resize the buffer to a new size.
  delete(self)
Delete this buffer, reducing system resource usage.

Instance Variables

int ptr = 0
Memory offset of the buffer, as used by the glVertexPointer family of functions
int size = 0
Size of buffer, in bytes
int target
OpenGL buffer target, for example GL_ARRAY_BUFFER
int usage
OpenGL buffer usage, for example GL_DYNAMIC_DRAW

Method Details

set_data

set_data(self, data)
Set the entire contents of the buffer.
Parameters:
data : sequence of int or ctypes pointer
The byte array to set.

set_data_region

set_data_region(self, data, start, length)
Set part of the buffer contents.
Parameters:
data : sequence of int or ctypes pointer
The byte array of data to set
start : int
Offset to start replacing data
length : int
Length of region to replace

map

map(self, invalidate=False)

Map the entire buffer into system memory.

The mapped region must be subsequently unmapped with unmap before performing any other operations on the buffer.

Parameters:
invalidate : bool
If True, the initial contents of the mapped block need not reflect the actual contents of the buffer.
Returns:
POINTER(ctypes.c_ubyte): Pointer to the mapped block in memory

resize

resize(self, size)
Resize the buffer to a new size.
Parameters:
size : int
New size of the buffer, in bytes