picogl.backend.gl.api.shader.uniform

Provides utility functions for managing shader programs and uniform variables in OpenGL.

This module includes methods to activate shader programs, update 4x4 matrix uniform variables, and handle uniform updates by their variable names. It serves as a utility layer for efficient OpenGL rendering tasks.

Classes

GLShader

GL Shader

Functions

gl_uniform_matrix_4fv(location, count, transpose, value) → None

Sets a 4x4 matrix for a given uniform variable in the currently active shader program.

gl_uniform_name_matrix_4f(value, location, uniform_name) → None

Updates a 4x4 matrix uniform variable in the OpenGL shader program.

gl_set_uniform_matrix(shader_program, ...)

gl set uniform matrix

Module Contents

picogl.backend.gl.api.shader.uniform.gl_uniform_matrix_4fv(location: int, count: int, transpose: picogl.boolean.GLBoolean, value: Any) → None[source]

Sets a 4x4 matrix for a given uniform variable in the currently active shader program.

Parameters: location (int): The location of the uniform variable to be updated. count (int): The number of matrices to be loaded. Typically 1. transpose (GLBoolean): Specifies whether to transpose the matrix values. value (Any): The matrix data to be assigned to the uniform variable.

Returns: None

picogl.backend.gl.api.shader.uniform.gl_uniform_name_matrix_4f(value: Any, location: int, uniform_name: str) → None[source]

Updates a 4x4 matrix uniform variable in the OpenGL shader program.

This function sets the value of a 4x4 matrix uniform variable within a specified OpenGL shader program. It locates the uniform variable by its name and location, then applies the given matrix value.

Parameters: value : Any

The 4x4 matrix to be used as the uniform value in the shader.

locationint

The reference to the OpenGL shader program.

uniform_namestr

The name of the uniform variable within the shader program.

Returns: None

class picogl.backend.gl.api.shader.uniform.GLShader[source]

Bases: enum.IntEnum

GL Shader

VERTEX_SHADER[source]
FRAGMENT_SHADER[source]
picogl.backend.gl.api.shader.uniform.gl_set_uniform_matrix(shader_program: int, shader_uniform_name: str, matrix: numpy.ndarray)[source]

gl set uniform matrix