class_docstr: Frame buffer object
  
  Parameters
  ----------
  color : RenderBuffer (optional)
      The color buffer to attach to this frame buffer
  depth : RenderBuffer (optional)
      The depth buffer to attach to this frame buffer
  stencil : RenderBuffer (optional)
      The stencil buffer to attach to this frame buffer
class_docstr_tok: ["Frame","buffer","object","Parameters","--","--","--","--","--","color",":","RenderBuffer","(","optional",")","The","color","buffer","to","attach","to","this","frame","buffer","depth",":","RenderBuffer","(","optional",")","The","depth","buffer","to","attach","to","this","frame","buffer","stencil",":","RenderBuffer","(","optional",")","The","stencil","buffer","to","attach","to","this","frame","buffer"]
code: def _set_buffer(self, buffer, format):
      formats = ("color", "depth", "stencil")
      assert format in formats
      # Auto-format or check render buffer
      if isinstance(buffer, RenderBuffer):
          if buffer.format is None:
              buffer.resize(buffer.shape, format)
          elif buffer.format in formats and buffer.format != format:
              raise ValueError(
                  "Cannot attach a %s buffer as %s buffer."
                  % (buffer.format, format)
              )
      # Attach
      if buffer is None:
          setattr(self, "_%s_buffer" % format, None)
          self._glir.command("ATTACH", self._id, format, 0)
      elif isinstance(buffer, (Texture2D, RenderBuffer)):
          self.glir.associate(buffer.glir)
          setattr(self, "_%s_buffer" % format, buffer)
          self._glir.command("ATTACH", self._id, format, buffer.id)
      else:
          raise TypeError(
              "Buffer must be a RenderBuffer, Texture2D or None."
              " (got %s)" % type(buffer)
          )
  
imports: from .globject import GLObject
  from .texture import Texture2D
  from .wrappers import _check_valid, read_pixels
  from .context import get_current_canvas
label_desc: Use image node_id 6 for calling the FrameBuffer obj's underlying member method code with example usage: obj._set_buffer(buffer, format) without return types