From 8d45d2c90c098ec428862182a46816e2d9b1cd90 Mon Sep 17 00:00:00 2001 From: "Lex Darlog (DRL)" <3897975+Lex-DRL@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:20:24 -0300 Subject: [PATCH] global `gl` -> `GLContext.GL` --- comfy_extras/nodes_glsl.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/comfy_extras/nodes_glsl.py b/comfy_extras/nodes_glsl.py index 933fc8729..741f73880 100644 --- a/comfy_extras/nodes_glsl.py +++ b/comfy_extras/nodes_glsl.py @@ -16,9 +16,6 @@ from utils.install_util import get_missing_requirements_message logger = logging.getLogger(__name__) -# OpenGL modules - initialized lazily when context is created -gl = None - def _check_opengl_availability(): """Early check for OpenGL availability. Raises RuntimeError if unlikely to work.""" @@ -284,13 +281,8 @@ class GLContext: def __import_opengl(self): """Import OpenGL module. Called after context is created.""" - global gl - if gl is not None: - return - logger.debug("__import_opengl: importing OpenGL.GL") import OpenGL.GL as _gl - gl = _gl self._gl = _gl logger.debug("__import_opengl: import completed") @@ -311,6 +303,11 @@ class GLContext: if self._vao is not None: self._glBindVertexArray(self._vao) + @property + def GL(self): + """Imported ``OpenGL.GL`` module.""" + return self._gl + def compile_shader(self, source: str, shader_type: int) -> int: """Compile a shader and return its ID.""" gl = self._gl