initGLContext method

void initGLContext()

Implementation

void initGLContext() {
  _scratchFrameBuffer = _gl.createFramebuffer();
  _srcFramebuffer = _gl.createFramebuffer();
	  _dstFramebuffer = _gl.createFramebuffer();

  extensions = WebGLExtensions(_gl);
  extensions.init();
  utils = WebGLUtils(extensions);

  capabilities = WebGLCapabilities(_gl, extensions, parameters, utils);
  state = WebGLState(_gl,extensions);

  if ( capabilities.reverseDepthBuffer && reverseDepthBuffer ) {
    state.buffers['depth'].setReversed( true );
  }

  info = WebGLInfo(_gl);
  properties = WebGLProperties();
  textures = WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);
  cubemaps = WebGLCubeMaps(this);
  cubeuvmaps = WebGLCubeUVMaps(this);
  attributes = WebGLAttributes(_gl);
  bindingStates = WebGLBindingStates(_gl, attributes);
  geometries = WebGLGeometries(_gl, attributes, info, bindingStates);
  objects = WebGLObjects(_gl, geometries, attributes, info);
  morphtargets = WebGLMorphtargets(_gl, capabilities, textures);
  clipping = WebGLClipping(properties);
  programCache = WebGLPrograms(this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);
  materials = WebGLMaterials(this, properties);
  renderLists = WebGLRenderLists();
  renderStates = WebGLRenderStates(extensions);
  background = WebGLBackground(this, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha);
  shadowMap = WebGLShadowMap(this, objects, capabilities);
  uniformsGroups = WebGLUniformsGroups( _gl, info, capabilities, state );

  bufferRenderer = WebGLBufferRenderer(_gl, extensions, info);
  indexedBufferRenderer = WebGLIndexedBufferRenderer(_gl, extensions, info);

  info.programs = programCache.programs;

  xr = _setXR?.call(this,gl) ?? WebXRManager(this, _gl);
  xr.init();
		xr.addEventListener( 'sessionstart', onXRSessionStart );
		xr.addEventListener( 'sessionend', onXRSessionEnd );
}