Skip to content

Commit

Permalink
Merge pull request #3982 from t20100/fix-pyopengl-python312
Browse files Browse the repository at this point in the history
silx.gui: Fixed support of OpenGL with python3.12 and pyopengl <=3.1.7
  • Loading branch information
vasole authored Nov 28, 2023
2 parents caa5929 + 635597c commit 3dd944b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/silx/gui/_glutils/gl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
from contextlib import contextmanager as _contextmanager
from ctypes import c_uint
import logging
import sys
from typing import Optional

from packaging.version import Version


_logger = logging.getLogger(__name__)

import OpenGL
Expand All @@ -47,6 +51,11 @@
OpenGL.ERROR_CHECKING = False
OpenGL.ERROR_ON_COPY = False

if sys.version_info >= (3, 12) and Version(OpenGL.__version__) <= Version("3.1.7"):
# Python3.12 patch: see https://github.com/mcfletch/pyopengl/pull/100
OpenGL.FormatHandler.by_name("ctypesparameter").check.append("_ctypes.CArgObject")


import OpenGL.GL as _GL
from OpenGL.GL import * # noqa
import OpenGL.platform
Expand Down

0 comments on commit 3dd944b

Please sign in to comment.