EN
此内容没有您的语言版本,但有英语版本。

precision property

Represents the precision in bits for a given data type.

This property is read-only.

IE11

 

Syntax

JavaScript
precision = object.precision

 

Property values

Type: Number

The precision (in bits). Default is 0 for integer formats.

Examples

This example sets the precision for a float in the shader source code. For more info on this example, see Get started with WebGL.


<!-- fragment shader -->
<script id="2d-fragment-shader" type="x-shader/x-fragment">
precision mediump float;

  // uniform to use for texture 
  uniform sampler2D u_image;

  // Output of the vertex shader 
  varying vec2 v_texCoord;

  void main() {
    // gl_FragColor always specifies the color to make the current pixel 
    gl_FragColor = texture2D(u_image, v_texCoord);                                                   
  }
</script>


See also

WebGLShaderPrecisionFormat

 

 

显示:
© 2014 Microsoft