-
Notifications
You must be signed in to change notification settings - Fork 22.7k
/
Copy pathindex.md
38 lines (25 loc) · 1.05 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
title: WebGLSampler
slug: Web/API/WebGLSampler
page-type: web-api-interface
browser-compat: api.WebGLSampler
---
{{APIRef("WebGL")}}{{AvailableInWorkers}}
The **`WebGLSampler`** interface is part of the [WebGL 2](/en-US/docs/Web/API/WebGL_API) API and stores sampling parameters for {{domxref("WebGLTexture")}} access inside of a shader.
{{InheritanceDiagram}}
When working with `WebGLSampler` objects, the following methods of the {{domxref("WebGL2RenderingContext")}} are useful:
- {{domxref("WebGL2RenderingContext.createSampler()")}}
- {{domxref("WebGL2RenderingContext.deleteSampler()")}}
- {{domxref("WebGL2RenderingContext.isSampler()")}}
- {{domxref("WebGL2RenderingContext.bindSampler()")}}
- {{domxref("WebGL2RenderingContext.getSamplerParameter()")}}
## Examples
### Creating a `WebGLSampler` object
in this example, `gl` must be a {{domxref("WebGL2RenderingContext")}}. `WebGLSampler` objects are not available in WebGL 1.
```js
const sampler = gl.createSampler();
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}