mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-10 16:27:33 +08:00
global gl -> GLContext.GL
This commit is contained in:
parent
1b2604d3a8
commit
8d45d2c90c
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user