class_docstr: Class for window rendering in all MuJoCo environments.
class_docstr_tok: ["Class","for","window","rendering","in","all","MuJoCo","environments","."]
code: def render(self):
      # mjv_updateScene, mjr_render, mjr_overlay
      def update():
          # fill overlay items
          self._create_overlay()
  
          render_start = time.time()
          if self.window is None:
              return
          elif glfw.window_should_close(self.window):
              glfw.destroy_window(self.window)
              glfw.terminate()
          (
              self.viewport.width,
              self.viewport.height,
          ) = glfw.get_framebuffer_size(self.window)
          with self._gui_lock:
              # update scene
              mujoco.mjv_updateScene(
                  self.model,
                  self.data,
                  self.vopt,
                  mujoco.MjvPerturb(),
                  self.cam,
                  mujoco.mjtCatBit.mjCAT_ALL.value,
                  self.scn,
              )
              # marker items
              for marker in self._markers:
                  self._add_marker_to_scene(marker)
              # render
              mujoco.mjr_render(self.viewport, self.scn, self.con)
              # overlay items
              if not self._hide_menu:
                  for gridpos, [t1, t2] in self._overlays.items():
                      mujoco.mjr_overlay(
                          mujoco.mjtFontScale.mjFONTSCALE_150,
                          gridpos,
                          self.viewport,
                          t1,
                          t2,
                          self.con,
                      )
              glfw.swap_buffers(self.window)
          glfw.poll_events()
          self._time_per_render = 0.9 * self._time_per_render + 0.1 * (
              time.time() - render_start
          )
  
          # clear overlay
          self._overlays.clear()
  
      if self._paused:
          while self._paused:
              update()
              if self._advance_by_one_step:
                  self._advance_by_one_step = False
                  break
      else:
          self._loop_count += self.model.opt.timestep / (
              self._time_per_render * self._run_speed
          )
          if self._render_every_frame:
              self._loop_count = 1
          while self._loop_count > 0:
              update()
              self._loop_count -= 1
  
      # clear markers
      self._markers[:] = []
  
imports: import collections
  import os
  import time
  from threading import Lock
  import glfw
  import imageio
  import mujoco
  import numpy
label_desc: Use image node_id 7 for calling the Viewer obj's underlying member method code with example usage: obj.render() without return types