EXT_shader_texture_lod 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_shader_texture_lod là một phần của WebGL API và thêm các hàm texture bổ sung vào OpenGL ES Shading Language, cho phép người viết shader kiểm soát rõ ràng LOD (Level of detail).
Các phần mở rộng WebGL có sẵn bằng cách sử dụng phương thức WebGLRenderingContext.getExtension().
Hàm dựng sẵn GLSL
Các hàm mới sau có thể được sử dụng trong mã shader GLSL nếu phần mở rộng này được bật:
c
vec4 texture2DLodEXT(sampler2D sampler, vec2 coord, float lod)
vec4 texture2DProjLodEXT(sampler2D sampler, vec3 coord, float lod)
vec4 texture2DProjLodEXT(sampler2D sampler, vec4 coord, float lod)
vec4 textureCubeLodEXT(samplerCube sampler, vec3 coord, float lod)
vec4 texture2DGradEXT(sampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy)
vec4 texture2DProjGradEXT(sampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy)
vec4 texture2DProjGradEXT(sampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy)
vec4 textureCubeGradEXT(samplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy)
Ví dụ
Bật phần mở rộng:
js
gl.getExtension("EXT_shader_texture_lod");
Thông số kỹ thuật
| Specification |
|---|
| WebGL EXT_shader_texture_lod Khronos Ratified Extension Specification> |