EXT_frag_depth extension
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Phần mở rộng EXT_frag_depth là một phần của WebGL API và cho phép đặt giá trị độ sâu của fragment từ bên trong fragment shader.
Các phần mở rộng WebGL có sẵn bằng cách sử dụng phương thức WebGLRenderingContext.getExtension().
Ví dụ
Bật phần mở rộng:
js
gl.getExtension("EXT_frag_depth");
Bây giờ biến đầu ra gl_FragDepthEXT có sẵn để đặt giá trị độ sâu của fragment từ bên trong fragment shader:
html
<script type="x-shader/x-fragment">
void main() {
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
gl_FragDepthEXT = 0.5;
}
</script>
Thông số kỹ thuật
| Specification |
|---|
| WebGL EXT_frag_depth Khronos Ratified Extension Specification> |