picogl.backend.modern.core.vertex.buffer.element
Element Buffer Object (EBO) Management for Modern OpenGL Rendering.
This module defines the ElementBufferObject class, which encapsulates the OpenGL element data buffer (also known as an index buffer). It is used to store indices that OpenGL uses to decide which vertices to draw, allowing for efficient reuse of vertex data in complex models.
The class handles:
- Creation and deletion of the EBO on the GPU.
- Binding and unbinding of the buffer.
- Storage of element/index data along with configuration parameters.
- Uploading the data to the GPU with picogl.wrappers.data.gl_buffer_data().
Example usage:
import numpy as np
from picogl.backend.modern.core.vertex.buffer.element import ModernEBO
from picogl.backend.gl.state.draw_mode import GLUsageHint
indices = np.array([0, 1, 2], dtype=np.uint32)
ebo = ModernEBO(data=indices)
with ebo:
ebo.set_element_attributes(
data=indices,
size=indices.nbytes,
dtype=GLUsageHint.STATIC_DRAW,
)
ebo.configure()
Classes
OpenGL element data buffer (also known as an index buffer) |
Module Contents
- class picogl.backend.modern.core.vertex.buffer.element.ModernEBO(handle: int | None = None, data: numpy.ndarray | None = None, size: int = 3, target: int = GLBufferTarget.ELEMENT)[source]
Bases:
picogl.backend.modern.core.vertex.base.VertexBufferOpenGL element data buffer (also known as an index buffer)
- set_element_attributes(data: numpy.ndarray, size: int, dtype: int = GLUsageHint.STATIC_DRAW)[source]
set_element_attributes
- Parameters:
data – np.ndarray
size – int
dtype – int
- Returns:
None