WebGLShaderPrecisionFormat

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

Note: This feature is available in Web Workers.

Giao diện WebGLShaderPrecisionFormat là một phần của WebGL API và đại diện cho thông tin được trả về bởi lệnh gọi phương thức WebGLRenderingContext.getShaderPrecisionFormat().

Thuộc tính phiên bản

WebGLShaderPrecisionFormat.rangeMin Read only

Logarithm cơ số 2 của giá trị tuyệt đối của giá trị tối thiểu có thể biểu diễn.

WebGLShaderPrecisionFormat.rangeMax Read only

Logarithm cơ số 2 của giá trị tuyệt đối của giá trị tối đa có thể biểu diễn.

WebGLShaderPrecisionFormat.precision Read only

Số bit độ chính xác có thể biểu diễn. Đối với định dạng số nguyên, giá trị này luôn là 0.

Ví dụ

Đối tượng WebGLShaderPrecisionFormat được trả về bởi phương thức WebGLRenderingContext.getShaderPrecisionFormat().

js
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT);
// WebGLShaderPrecisionFormat { rangeMin: 127, rangeMax: 127, precision: 23 }

Thông số kỹ thuật

Specification
WebGL Specification
# 5.12

Tương thích trình duyệt

Xem thêm