reset method

void reset()

Implementation

void reset() {
  // reset state

  gl.disable(gl.BLEND);
  gl.disable(gl.CULL_FACE);
  gl.disable(gl.DEPTH_TEST);
  gl.disable(gl.POLYGON_OFFSET_FILL);
  gl.disable(gl.SCISSOR_TEST);
  gl.disable(gl.STENCIL_TEST);
  gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);

  gl.blendEquation(gl.FUNC_ADD);
  gl.blendFunc(gl.ONE, gl.ZERO);
  gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO);

  gl.colorMask(true, true, true, true);
  gl.clearColor(0, 0, 0, 0);

  gl.depthMask(true);
  gl.depthFunc(gl.LESS);
  gl.clearDepth(1);

  gl.stencilMask(0xffffffff);
  gl.stencilFunc(gl.ALWAYS, 0, 0xffffffff);
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
  gl.clearStencil(0);

  gl.cullFace(gl.BACK);
  gl.frontFace(gl.CCW);

  gl.polygonOffset(0, 0);

  gl.activeTexture(gl.TEXTURE0);

  if (isWebGL2 == true) {
    gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); // Equivalent to gl.FRAMEBUFFER
    gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
  } else {
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
  }

  gl.useProgram(null);

  gl.lineWidth(1);

  // TODO app gl no canvas ???
  // gl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );
  // gl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );
  gl.scissor(0, 0, 0, 0);
  gl.viewport(0, 0, 0, 0);

  // reset internals

  enabledCapabilities = {};

  currentTextureSlot = null;
  currentBoundTextures = {};

  xrFramebuffer = null;
  currentBoundFramebuffers = {};
  currentDrawbuffers = WeakMap();
  defaultDrawbuffers = [];

  currentProgram = null;

  currentBlendingEnabled = false;
  currentBlending = null;
  currentBlendEquation = null;
  currentBlendSrc = null;
  currentBlendDst = null;
  currentBlendEquationAlpha = null;
  currentBlendSrcAlpha = null;
  currentBlendDstAlpha = null;
  currentPremultipledAlpha = false;

  currentFlipSided = null;
  currentCullFace = null;

  currentLineWidth = null;

  currentPolygonOffsetFactor = null;
  currentPolygonOffsetUnits = null;

  colorBuffer.reset();
  depthBuffer.reset();
  stencilBuffer.reset();
}