Firefox Tomorrow

web api instance method

WebGLRenderingContext: createTexture() method

View on MDN ↗

Available in workers

The WebGLRenderingContext.createTexture() method of the WebGL API creates and initializes a WebGLTexture object.

Syntax

createTexture()

Parameters

None.

Return value

A WebGLTexture object to which images can be bound to.

Examples

See also the WebGL tutorial on Using textures in WebGL.

Creating a texture

const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
const texture = gl.createTexture();

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also