Source code for picogl.backend.gl.state.shader
"""Scoped shader program binding."""
from __future__ import annotations
from contextlib import contextmanager
from typing import Iterator, Protocol
@contextmanager
[docs]
def gl_shader_bound(shader: _BindableShader) -> Iterator[None]:
"""Bind *shader* for the duration of the ``with`` block, then unbind."""
shader.bind()
try:
yield
finally:
shader.unbind()