class_docstr: Offscreen rendering class with opengl context.
class_docstr_tok: ["Offscreen","rendering","class","with","opengl","context","."]
code: def _get_opengl_backend(self, width, height):
      backend = os.environ.get("MUJOCO_GL")
      if backend is not None:
          try:
              self.opengl_context = _ALL_RENDERERS[backend](
                  width, height
              )
          except KeyError:
              raise RuntimeError(
                  "Environment variable {} must be one of {!r}: got {!r}.".format(
                      "MUJOCO_GL", _ALL_RENDERERS.keys(), backend
                  )
              )
  
      else:
          for name, _ in _ALL_RENDERERS.items():
              try:
                  self.opengl_context = _ALL_RENDERERS[name](
                      width, height
                  )
                  backend = name
                  break
              except:  # noqa:E722
                  pass
          if backend is None:
              raise RuntimeError(
                  "No OpenGL backend could be imported. Attempting to create a "
                  "rendering context will result in a RuntimeError."
              )
  
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 2 for calling the RenderContextOffscreen obj's underlying member method code with example usage: obj._get_opengl_backend(width, height) without return types