Back to Content

WebGL2RenderingContext: createSampler() method

files/en-us/web/api/webgl2renderingcontext/createsampler/index.md

latest625 B
Original Source

{{APIRef("WebGL")}}{{AvailableInWorkers}}

The WebGL2RenderingContext.createSampler() method of the WebGL 2 API creates and initializes {{domxref("WebGLSampler")}} objects.

Syntax

js-nolint
createSampler()

Parameters

None.

Return value

A {{domxref("WebGLSampler")}} object.

Examples

gl must be a {{domxref("WebGL2RenderingContext")}}. WebGLSampler objects are not available in WebGL 1.

js
const sampler = gl.createSampler();

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("WebGLSampler")}}