Skip to content

Commit

Permalink
Dynamically increase offscreen framebuffer size.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzakka committed Jan 18, 2023
1 parent 0804655 commit 3b4be04
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dm_env_wrappers/_src/mujoco/dm_control_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def __init__(
self._height = height
self._width = width

# Ensure the offscreen framebuffer is large enough to accommodate the requested
# resolution.
new_offwidth = max(self.physics.model.vis.global_.offwidth, width)
new_offheight = max(self.physics.model.vis.global_.offheight, height)
mjcf_model = self._task.root_entity.mjcf_model
mjcf_model.visual.__getattr__("global").offheight = new_offheight
mjcf_model.visual.__getattr__("global").offwidth = new_offwidth

# Helper methods.

def _render_frame(self, observation) -> np.ndarray:
Expand Down

0 comments on commit 3b4be04

Please sign in to comment.