Allow gl_context.GLContext to be None.
PiperOrigin-RevId: 625927487 Change-Id: I85d5658c8ea529716aaac12b17957c59319367cc
This commit is contained in:
committed by
Copybara-Service
parent
4a76496533
commit
d2392efe6c
@@ -78,8 +78,11 @@ the clause:
|
|||||||
|
|
||||||
# Create render contexts.
|
# Create render contexts.
|
||||||
# TODO(nimrod): Figure out why pytype doesn't like gl_context.GLContext
|
# TODO(nimrod): Figure out why pytype doesn't like gl_context.GLContext
|
||||||
self._gl_context = gl_context.GLContext(width, height) # type: ignore
|
self._gl_context = None # type: ignore
|
||||||
self._gl_context.make_current()
|
if gl_context.GLContext is not None:
|
||||||
|
self._gl_context = gl_context.GLContext(width, height)
|
||||||
|
if self._gl_context:
|
||||||
|
self._gl_context.make_current()
|
||||||
self._mjr_context = _render.MjrContext(
|
self._mjr_context = _render.MjrContext(
|
||||||
model, _enums.mjtFontScale.mjFONTSCALE_150.value
|
model, _enums.mjtFontScale.mjFONTSCALE_150.value
|
||||||
)
|
)
|
||||||
@@ -148,9 +151,11 @@ the clause:
|
|||||||
self._scene.flags[_enums.mjtRndFlag.mjRND_SEGMENT] = True
|
self._scene.flags[_enums.mjtRndFlag.mjRND_SEGMENT] = True
|
||||||
self._scene.flags[_enums.mjtRndFlag.mjRND_IDCOLOR] = True
|
self._scene.flags[_enums.mjtRndFlag.mjRND_IDCOLOR] = True
|
||||||
|
|
||||||
if self._gl_context is None:
|
if self._mjr_context is None:
|
||||||
raise RuntimeError('render cannot be called after close.')
|
raise RuntimeError('render cannot be called after close.')
|
||||||
self._gl_context.make_current()
|
|
||||||
|
if self._gl_context:
|
||||||
|
self._gl_context.make_current()
|
||||||
|
|
||||||
if self._depth_rendering:
|
if self._depth_rendering:
|
||||||
out_shape = (self._height, self._width)
|
out_shape = (self._height, self._width)
|
||||||
|
|||||||
Reference in New Issue
Block a user