def upload_texture(self, name):
     """
     Uploads the texture to the GPU so it's available in the rendering.
     """
     texture = self.get_texture(name)
     if not self.sim.render_contexts:
         cymj.MjRenderContextOffscreen(self.sim)
     for render_context in self.sim.render_contexts:
         render_context.upload_texture(texture.id)
Exemple #2
0
 def __init__(self,
              env,
              camera_name=None,
              render_width=512,
              render_height=512):
     super().__init__(env)
     self._mujoco_env = isinstance(env, MujocoEnv)
     if self._mujoco_env and camera_name is None:
         camera_name = env.sim.model.camera_names[0]
     self.camera_name = camera_name
     self.render_width = render_width
     self.render_height = render_height
     # TODO this still opens a dead window
     self.env.sim.add_render_context(
         cymj.MjRenderContextOffscreen(self.env.sim, 0))