title | short-title | slug | page-type | browser-compat |
---|---|---|---|---|
WebGL2RenderingContext: bindSampler() method |
bindSampler() |
Web/API/WebGL2RenderingContext/bindSampler |
web-api-instance-method |
api.WebGL2RenderingContext.bindSampler |
{{APIRef("WebGL")}}
The WebGL2RenderingContext.bindSampler()
method of the WebGL 2 API binds a
passed {{domxref("WebGLSampler")}} object to the texture unit at the passed index.
bindSampler(unit, sampler)
unit
- : A {{domxref("WebGL_API/Types", "GLuint")}} specifying the index of the texture unit to which to bind the sampler to.
sampler
- : A {{domxref("WebGLSampler")}} object to bind.
None ({{jsxref("undefined")}}).
const sampler = gl.createSampler();
gl.bindSampler(0, sampler);
{{Specifications}}
{{Compat}}
- {{domxref("WebGLSampler")}}