vbo module

This module processes an application’s vertex buffer objects (VBOs). VBOs are buffer objects we use for vertex processing.

In reality, we can use buffer objects for means outside of vertex processing.

class vbo.AdvancedSkyBoxVBO(ctx)[source]

Bases: BaseVBO

Advanced skybox VBO using fullscreen triangle for efficient rendering.

Generates a large triangle that covers the entire screen for skybox projection.

get_vertex_data()[source]

Generate vertex data for fullscreen triangle.

Returns:

NumPy array containing three vertices that cover screen space

Return type:

numpy.ndarray

class vbo.BaseVBO(ctx)[source]

Bases: object

Base class for vertex buffer objects.

Provides common VBO functionality that subclasses extend with specific geometry.

destroy()[source]

Release vertex buffer resources.

Clean up VBO when no longer needed.

get_vbo()[source]

Create vertex buffer object from vertex data.

Returns:

Vertex buffer object containing geometry data

Return type:

VBO

get_vertex_data()[source]

Get vertex data for specific geometry.

Subclasses override this method with geometry-specific implementation.

class vbo.CatVBO(app)[source]

Bases: BaseVBO

Cat model vertex buffer object loaded from OBJ file.

Uses pywavefront to load complex mesh data with textures and normals.

get_vertex_data()[source]

Load cat model vertex data from OBJ file.

Returns:

NumPy array containing cat mesh vertex data

Return type:

numpy.ndarray

class vbo.CubeVBO(ctx)[source]

Bases: BaseVBO

Cube vertex buffer object with texture coordinates and normals.

Generates vertex data for a unit cube centered at origin.

static get_data(vertices, indices)[source]

Extract vertex data from vertices using indices.

Parameters:
  • vertices (list) – List of vertex positions

  • indices (list) – List of triangle indices

Returns:

NumPy array of vertex data in order specified by indices

Return type:

numpy.ndarray

get_vertex_data()[source]

Generate complete vertex data for cube including positions, normals, and texture coordinates.

Returns:

NumPy array containing interleaved vertex data

Return type:

numpy.ndarray

class vbo.SkyBoxVBO(ctx)[source]

Bases: BaseVBO

Skybox vertex buffer object for cubemap rendering.

Generates inside-out cube geometry for skybox rendering.

static get_data(vertices, indices)[source]

Extract vertex data from vertices using indices.

Parameters:
  • vertices (list) – List of vertex positions

  • indices (list) – List of triangle indices

Returns:

NumPy array of vertex data in order specified by indices

Return type:

numpy.ndarray

get_vertex_data()[source]

Generate vertex data for inside-out skybox cube.

Returns:

NumPy array containing skybox vertex data

Return type:

numpy.ndarray

class vbo.VBO(ctx)[source]

Bases: object

destroy()[source]