reset method

void reset()

Implementation

void reset() {
  gl.disable(WebGL.BLEND);
  gl.disable(WebGL.CULL_FACE);
  gl.disable(WebGL.DEPTH_TEST);
  gl.disable(WebGL.POLYGON_OFFSET_FILL);
  gl.disable(WebGL.SCISSOR_TEST);
  gl.disable(WebGL.STENCIL_TEST);
  gl.disable(WebGL.SAMPLE_ALPHA_TO_COVERAGE);

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

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

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

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

  gl.cullFace(WebGL.BACK);
  gl.frontFace(WebGL.CCW);
  gl.polygonOffset(0, 0);
  gl.activeTexture(WebGL.TEXTURE0);

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

  gl.useProgram(null);
  gl.lineWidth(1);
  // gl.scissor(0, 0, 0, 0);
  // gl.viewport(0, 0, 0, 0);
  gl.scissor(0, 0, gl.width, gl.height);
  gl.viewport(0, 0, gl.width, gl.height);

  // 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;

		currentScissor.setValues( 0, 0, gl.width.toDouble(), gl.height.toDouble() );
		currentViewport.setValues( 0, 0, gl.width.toDouble(), gl.height.toDouble() );

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