bindFramebuffer method

bool bindFramebuffer(
  1. dynamic target,
  2. Framebuffer? framebuffer
)

Implementation

bool bindFramebuffer(target, Framebuffer? framebuffer) {
  if (framebuffer == null && xrFramebuffer != null) {
    framebuffer = xrFramebuffer;
  } // use active XR framebuffer if available

  if (currentBoundFramebuffers[target] != framebuffer) {
    gl.bindFramebuffer(target, framebuffer);

    currentBoundFramebuffers[target] = framebuffer;

    if (isWebGL2) {
      // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER

      if (target == WebGL.DRAW_FRAMEBUFFER) {
        currentBoundFramebuffers[WebGL.FRAMEBUFFER] = framebuffer;
      }

      if (target == WebGL.FRAMEBUFFER) {
        currentBoundFramebuffers[WebGL.DRAW_FRAMEBUFFER] = framebuffer;
      }
    }

    return true;
  }

  return false;
}