WebGLCapabilities constructor
WebGLCapabilities(
- RenderingContext gl,
- WebGLExtensions extensions,
- Map<
String, dynamic> parameters
Implementation
WebGLCapabilities(this.gl, this.extensions, this.parameters) {
precision = parameters["precision"] ?? "highp";
maxPrecision = getMaxPrecision(precision);
if (maxPrecision != precision) {
console.warning('WebGLRenderer: $precision not supported, using $maxPrecision instead.');
precision = maxPrecision;
}
logarithmicDepthBuffer = parameters["logarithmicDepthBuffer"] == true;
maxTextures = gl.getParameter(WebGL.MAX_TEXTURE_IMAGE_UNITS);
maxVertexTextures = gl.getParameter(WebGL.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
maxTextureSize = gl.getParameter(WebGL.MAX_TEXTURE_SIZE);
maxCubemapSize = gl.getParameter(WebGL.MAX_CUBE_MAP_TEXTURE_SIZE);
maxAttributes = gl.getParameter(WebGL.MAX_VERTEX_ATTRIBS);
maxVertexUniforms = gl.getParameter(WebGL.MAX_VERTEX_UNIFORM_VECTORS);
maxVaryings = gl.getParameter(WebGL.MAX_VARYING_VECTORS);
maxFragmentUniforms = gl.getParameter(WebGL.MAX_FRAGMENT_UNIFORM_VECTORS);
vertexTextures = maxVertexTextures > 0;
floatFragmentTextures = isWebGL2;
floatVertexTextures = vertexTextures && floatFragmentTextures;
maxSamples = isWebGL2 ? gl.getParameter(WebGL.MAX_SAMPLES) : 0;
}