Add Renderer class to Python native bindings.

PiperOrigin-RevId: 492994751
Change-Id: Iebbe5980668a15b1cd62c0076cc131255462b2eb
This commit is contained in:
Kyle Bayes
2022-12-05 06:53:42 -08:00
committed by Copybara-Service
parent 341578450f
commit ef695bb8a8
5 changed files with 328 additions and 21 deletions
+2 -21
View File
@@ -43,27 +43,8 @@ from mujoco._errors import *
from mujoco._functions import *
from mujoco._render import *
from mujoco._structs import *
# pylint: disable=g-import-not-at-top
_MUJOCO_GL = os.environ.get('MUJOCO_GL', '').lower().strip()
if _MUJOCO_GL not in ('disable', 'disabled', 'off', 'false', '0'):
_VALID_MUJOCO_GL = ('enable', 'enabled', 'on', 'true', '1' , 'glfw', '')
if _SYSTEM == 'Linux':
_VALID_MUJOCO_GL += ('glx', 'egl', 'osmesa')
elif _SYSTEM == 'Windows':
_VALID_MUJOCO_GL += ('wgl',)
elif _SYSTEM == 'Darwin':
_VALID_MUJOCO_GL += ('cgl',)
if _MUJOCO_GL not in _VALID_MUJOCO_GL:
raise RuntimeError(
f'invalid value for environment variable MUJOCO_GL: {_MUJOCO_GL}')
if _SYSTEM == 'Linux' and _MUJOCO_GL == 'osmesa':
from mujoco.osmesa import GLContext
elif _SYSTEM == 'Linux' and _MUJOCO_GL == 'egl':
from mujoco.egl import GLContext
else:
from mujoco.glfw import GLContext
from mujoco.gl_context import *
from mujoco.renderer import Renderer
HEADERS_DIR = os.path.join(os.path.dirname(__file__), 'include/mujoco')
PLUGINS_DIR = os.path.join(os.path.dirname(__file__), 'plugin')