WebGLCapabilities constructor

WebGLCapabilities(
  1. dynamic gl,
  2. WebGLExtensions extensions,
  3. Map<String, dynamic> parameters
)

Implementation

WebGLCapabilities(this.gl, this.extensions, this.parameters) {
  precision = parameters["precision"] ?? "highp";

  maxPrecision = getMaxPrecision(precision);
  if (maxPrecision != precision) {
    print('three.WebGLRenderer: $precision not supported, using $maxPrecision instead.');
    precision = maxPrecision;
  }

  logarithmicDepthBuffer = parameters["logarithmicDepthBuffer"] == true;

  maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
  maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
  maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
  maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);

  maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
  maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);
  maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS);
  maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);

  vertexTextures = maxVertexTextures > 0;
  floatFragmentTextures = isWebGL2;
  floatVertexTextures = vertexTextures && floatFragmentTextures;

  maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;
}