Add low-level CGL context management for macOS.

This allows rendering from non-main threads as the context is not tied to a Cocoa window.

Fixes #742
Fixes #798

PiperOrigin-RevId: 523144359
Change-Id: I98432debdd034814c313eda94e38c248c3c1f76c
This commit is contained in:
Saran Tunyasuvunakool
2023-04-10 10:09:06 -07:00
committed by Copybara-Service
parent b536e46cc0
commit 6d63e046fd
4 changed files with 223 additions and 0 deletions
+3
View File
@@ -40,6 +40,9 @@ if _MUJOCO_GL not in ('disable', 'disabled', 'off', 'false', '0'):
elif _SYSTEM == 'Linux' and _MUJOCO_GL == 'egl':
from mujoco.egl import GLContext as _GLContext
GLContext = _GLContext
elif _SYSTEM == 'Darwin':
from mujoco.cgl import GLContext as _GLContext
GLContext = _GLContext
else:
from mujoco.glfw import GLContext as _GLContext
GLContext = _GLContext