picogl.backend.texture

Module provides utility functions and a class for managing OpenGL textures.

This module contains context managers for handling texture bindings, utility functions for creating procedural textures, and the TextureManager class for managing and reloading textures. It integrates with OpenGL through a backend driver, providing streamlined texture handling and fallback behavior.

Classes

TextureManager

TextureManager

Functions

gl_texture_binding(texture_gl_id)

gl texture binding

bind_texture(tex)

bind_texture

get_texture_path(→ pathlib.Path)

Return absolute path to a texture.

create_checkerboard(texture_data, texture_size)

Create a checkerboard pattern

create_checkerboard_array(→ numpy.ndarray)

Create fallback RGB checkerboard texture data.

Module Contents

picogl.backend.texture.gl_texture_binding(texture_gl_id: int | None)[source]

gl texture binding

picogl.backend.texture.bind_texture(tex: picogl.texture.texture2d.Texture2D | None)[source]

bind_texture

picogl.backend.texture.get_texture_path(texture_name: str) pathlib.Path[source]

Return absolute path to a texture.

picogl.backend.texture.create_checkerboard(texture_data: numpy.ndarray[Any, Any], texture_size: int)[source]

Create a checkerboard pattern

picogl.backend.texture.create_checkerboard_array(texture_size: int) numpy.ndarray[source]

Create fallback RGB checkerboard texture data.

class picogl.backend.texture.TextureManager(backend)[source]

TextureManager

backend[source]
_textures: dict[str, int][source]
_timestamps: dict[str, float][source]
get(name: str) int[source]
_reload(name: str, path: pathlib.Path, mtime: float)[source]
_get_fallback(name: str) int[source]