picogl.backend.state

Render-state descriptors and command helpers for PicoGL backends.

The classes in this module are intentionally backend-neutral: they describe desired OpenGL state and delegate the actual gl calls to a backend object.

Classes

RasterState

Raster State

GLStateManager

Tracks capability state without querying OpenGL.

BlendState

Blend State

DepthState

Depth State

RenderState

Flat render-state descriptor with nested-state constructor support.

RenderStateApplier

Applies render-state deltas through a gl backend.

GLVertexBuffer

GLAttributeArray

gl Attribute Array

GLViewport

TestGLMesh

Test gl Mesh

DrawCommand

Draw Command

GLClipPlaneState

gl Clipping Plane State

Functions

gl_value(→ Any)

Return a raw OpenGL value for PicoGL enums or pass raw values through.

Module Contents

picogl.backend.state.gl_value(value: Any) Any[source]

Return a raw OpenGL value for PicoGL enums or pass raw values through.

class picogl.backend.state.RasterState[source]

Raster State

polygon_mode: Any[source]
line_width: float = 1.0[source]
polygon_offset: tuple[float, float] = (0.0, 0.0)[source]
point_size: float | None = None[source]
apply(backend: Any) None[source]
class picogl.backend.state.GLStateManager(backend: CapabilityDriver)[source]

Tracks capability state without querying OpenGL.

backend[source]
_caps: dict[int, bool][source]
set_enabled(cap: int, enabled: bool) None[source]
is_enabled(cap: int) bool[source]
class picogl.backend.state.BlendState[source]

Blend State

enabled: bool = False[source]
src: Any[source]
dst: Any[source]
apply(state: GLStateManager)[source]
class picogl.backend.state.DepthState(test: bool = True, write: bool = True, enabled: bool | None = None)[source]

Depth State

test: bool = True[source]
write: bool = True[source]
property enabled: bool[source]
apply(state: GLStateManager)[source]
class picogl.backend.state.RenderState(*, raster: RasterState | None = None, depth: DepthState | None = None, blend: BlendState | bool | None = None, blend_src: Any = GLBlendFactor.SRC_ALPHA, blend_dst: Any = GLBlendFactor.ONE_MINUS_SRC_ALPHA, depth_test: bool | None = None, depth_write: bool | None = None, line_width: float | None = None, polygon_mode: Any | None = None, polygon_offset: tuple[float, float] | None = None, point_size: float | None = None, program_point_size: bool = False, cull_face: bool = False, lighting: bool = False)[source]

Flat render-state descriptor with nested-state constructor support.

blend: bool = False[source]
blend_src: Any[source]
blend_dst: Any[source]
depth_test: bool = True[source]
depth_write: bool = True[source]
line_width: float = 1.0[source]
polygon_mode: Any[source]
polygon_offset: tuple[float, float] = (0.0, 0.0)[source]
point_size: float | None = None[source]
program_point_size: bool = False[source]
cull_face: bool = False[source]
lighting: bool = False[source]
property raster: RasterState[source]
property depth: DepthState[source]
property blend_state: BlendState[source]
class picogl.backend.state.RenderStateApplier(backend: Any)[source]

Applies render-state deltas through a gl backend.

backend[source]
current: RenderState | None = None[source]
apply(state: RenderState)[source]
class picogl.backend.state.GLVertexBuffer(data: numpy.ndarray)[source]
data[source]
bind_legacy()[source]
class picogl.backend.state.GLAttributeArray[source]

gl Attribute Array

size: int[source]
dtype: Any[source]
stride: int[source]
pointer: Any[source]
enable_legacy(kind)[source]
class picogl.backend.state.GLViewport[source]
x: int[source]
y: int[source]
width: int[source]
height: int[source]
apply()[source]
class picogl.backend.state.TestGLMesh(vertices, indices=None)[source]

Test gl Mesh

vertices[source]
indices = None[source]
attributes: list[GLAttributeArray] = [][source]
add_attribute(attr: GLAttributeArray)[source]
draw()[source]
class picogl.backend.state.DrawCommand[source]

Draw Command

mesh: Any[source]
mode: int | None = None[source]
texture: picogl.texture.gltexture_driver.GLTextureDriver | int | None = None[source]
state: RenderState | None = None[source]
execute(backend: Any)[source]
class picogl.backend.state.GLClipPlaneState[source]

gl Clipping Plane State

enabled0: bool = False[source]
enabled1: bool = False[source]
apply(state: GLStateManager)[source]