Update EGL init code for Python 3.12.
Fixes google-deepmind/mujoco#1299. PiperOrigin-RevId: 595982512 Change-Id: Ib0261483a7f6cb8addf04f5010f09d3554c8bf45
This commit is contained in:
committed by
Copybara-Service
parent
721e2d5589
commit
ca023a6f28
@@ -92,12 +92,13 @@ class GLContext:
|
||||
del max_width, max_height # unused
|
||||
num_configs = ctypes.c_long()
|
||||
config_size = 1
|
||||
config = EGL.EGLConfig()
|
||||
# ctypes syntax for making an array of length config_size.
|
||||
configs = (EGL.EGLConfig * config_size)()
|
||||
EGL.eglReleaseThread()
|
||||
EGL.eglChooseConfig(
|
||||
EGL_DISPLAY,
|
||||
EGL_ATTRIBUTES,
|
||||
ctypes.byref(config),
|
||||
configs,
|
||||
config_size,
|
||||
num_configs)
|
||||
if num_configs.value < 1:
|
||||
@@ -106,7 +107,7 @@ class GLContext:
|
||||
'desired attributes: {}'.format(EGL_ATTRIBUTES))
|
||||
EGL.eglBindAPI(EGL.EGL_OPENGL_API)
|
||||
self._context = EGL.eglCreateContext(
|
||||
EGL_DISPLAY, config, EGL.EGL_NO_CONTEXT, None)
|
||||
EGL_DISPLAY, configs[0], EGL.EGL_NO_CONTEXT, None)
|
||||
if not self._context:
|
||||
raise RuntimeError('Cannot create an EGL context.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user