class_docstr: Render context superclass for offscreen and window rendering.
class_docstr_tok: ["Render","context","superclass","for","offscreen","and","window","rendering","."]
code: def render(self, camera_id=None, segmentation=False):
      width, height = self.offwidth, self.offheight
      rect = mujoco.MjrRect(
          left=0, bottom=0, width=width, height=height
      )
  
      if camera_id is not None:
          if camera_id == -1:
              self.cam.type = mujoco.mjtCamera.mjCAMERA_FREE
          else:
              self.cam.type = mujoco.mjtCamera.mjCAMERA_FIXED
          self.cam.fixedcamid = camera_id
  
      mujoco.mjv_updateScene(
          self.model,
          self.data,
          self.vopt,
          self.pert,
          self.cam,
          mujoco.mjtCatBit.mjCAT_ALL,
          self.scn,
      )
  
      if segmentation:
          self.scn.flags[mujoco.mjtRndFlag.mjRND_SEGMENT] = 1
          self.scn.flags[mujoco.mjtRndFlag.mjRND_IDCOLOR] = 1
  
      for marker_params in self._markers:
          self._add_marker_to_scene(marker_params)
  
      mujoco.mjr_render(rect, self.scn, self.con)
  
      for gridpos, (text1, text2) in self._overlays.items():
          mujoco.mjr_overlay(
              mujoco.mjtFontScale.mjFONTSCALE_150,
              gridpos,
              rect,
              text1.encode(),
              text2.encode(),
              self.con,
          )
  
      if segmentation:
          self.scn.flags[mujoco.mjtRndFlag.mjRND_SEGMENT] = 0
          self.scn.flags[mujoco.mjtRndFlag.mjRND_IDCOLOR] = 0
  
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 3 for calling the RenderContext obj's underlying member method code with example usage: obj.render(camera_id, segmentation) without return types