此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
WebGLShaderPrecisionFormat
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
* Some parts of this feature may have varying levels of support.
WebGLShaderPrecisionFormat 接口是WebGL API 的一部分,它表示通过调用WebGLRenderingContext.getShaderPrecisionFormat()返回信息的信息。
In this article
属性
WebGLShaderPrecisionFormat.rangeMin以 2 为底的最小值的绝对值的对数。
WebGLShaderPrecisionFormat.rangeMax可以表示的最大值的绝对值的底数为 2 的对数。
WebGLShaderPrecisionFormat.precision可以表示的精度位的数目。对于整数类型,这个值总是 0。
示例
WebGLShaderPrecisionFormat 对象通过WebGLRenderingContext.getShaderPrecisionFormat() 方法来返回。
js
var canvas = document.getElementById("canvas");var gl = canvas.getContext("webgl");gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT);// WebGLShaderPrecisionFormat { rangeMin: 127, rangeMax: 127, precision: 23 }规格
| Specification |
|---|
| WebGL Specification> # 5.12> |