AbstractBuffer Class

Inheritance diagram of AbstractBuffer

class AbstractBuffer

Abstract buffer of byte data.

Variables:
  • size – Size of buffer, in bytes
  • ptr – Memory offset of the buffer, as used by the glVertexPointer family of functions
  • target – OpenGL buffer target, for example GL_ARRAY_BUFFER
  • usage – OpenGL buffer usage, for example GL_DYNAMIC_DRAW

Methods:

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

Attributes:

ptr Type: int
size Type: int

Methods

AbstractBuffer.bind()

Bind this buffer to its OpenGL target.

AbstractBuffer.delete()

Delete this buffer, reducing system resource usage.

AbstractBuffer.map(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.
Return type:POINTER(ctypes.c_ubyte)
Returns:Pointer to the mapped block in memory
AbstractBuffer.resize(size)

Resize the buffer to a new size.

Parameters:size (int) – New size of the buffer, in bytes
AbstractBuffer.set_data(data)

Set the entire contents of the buffer.

Parameters:data (sequence of int or ctypes pointer) – The byte array to set.
AbstractBuffer.set_data_region(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
AbstractBuffer.unbind()

Reset the buffer’s OpenGL target.

AbstractBuffer.unmap()

Unmap a previously mapped memory block.

Attributes

AbstractBuffer.ptr = 0
AbstractBuffer.size = 0

Table Of Contents

Previous topic

create_mappable_buffer Function

Next topic

AbstractBufferRegion Class