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
Enforces one-time initialization with optional lazy semantics. |
|
Enforces one-time binding with optional lazy semantics. |
Module Contents
- class picogl.renderer.initializable.Initializable[source]
Enforces one-time initialization with optional lazy semantics.