--- title: WebGLSampler slug: Web/API/WebGLSampler tags: - API - WebGL - WebGL2 - 参考 - 实验性 translation_of: Web/API/WebGLSampler ---
WebGL 2 API 的 WebGLSampler 接口存储一系列采样参数,供 {{domxref("WebGLTexture")}} 在着色器中访问。
当使用 WebGLSampler 对象时,有以下 {{domxref("WebGL2RenderingContext")}} 相关方法:
WebGLSampler 对象在本例中,gl 必须是一个 {{domxref("WebGL2RenderingContext")}} 对象。因为 WebGLSampler 在 WebGL 1 中是不可用的。
var sampler = gl.createSampler();
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('WebGL2', "#3.3", "WebGLSample")}} | {{Spec2('WebGL2')}} | 初始定义。 |
{{Compat("api.WebGLSampler")}}