picogl.renderer.initializable

One-shot lifecycle helpers for renderer resources.

Initializable — GPU/setup work runs once until the object is discarded (e.g. framebuffer creation, renderer _do_initialize).

Bindable — OpenGL binding is sticky within a pass: repeated bind() is a no-op until unbind(). Use for pass-scoped helpers such as ShaderPipeline and LegacyClientMeshBinding.

Do not mix Bindable into types that rely on nested context managers or state restore (ShaderProgram.__enter__, VAO with, GLFramebuffer.bound()). Those need stack/restore semantics, not a single sticky flag.

Also do not subclass Bindable from VertexBase, VertexBufferGroup, VAO/VBO types, or DrawableBuffer implementations. They use stack-based bind/unbind (every with calls bind then unbind); sticky _bound would disagree with actual gl state after nested with vbo scopes. For pass-scoped VAO binding without with churn, use a separate wrapper (StickyVAOBinding) only if profiling warrants it — not inheritance on VertexBase.

Classes

Initializable

Enforces one-time initialization with optional lazy semantics.

Bindable

Enforces one-time binding with optional lazy semantics.

Module Contents

class picogl.renderer.initializable.Initializable[source]

Enforces one-time initialization with optional lazy semantics.

__slots__ = ('_initialized',)[source]
_initialized = False[source]
initialize() None[source]
abstract _do_initialize() None[source]

Subclass must implement actual initialization.

ensure_initialized() None[source]

Call before any operation that requires initialization.

require_initialized() None[source]

Strict check (no auto-init).

class picogl.renderer.initializable.Bindable[source]

Enforces one-time binding with optional lazy semantics.

Not for VAO/VBO/VertexBase types; see module docstring.

__slots__ = ('_bound',)[source]
_bound = False[source]
bind() None[source]
abstract _do_binding() None[source]
ensure_bound() None[source]
require_bound() None[source]
unbind() None[source]
abstract _do_unbinding() None[source]
__enter__()[source]
__exit__(exc_type, exc_val, exc_tb)[source]