docs.rodeo

MDN Web Docs mirror

WebGL2RenderingContext: texImage3D() method

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

The texImage3D() method of the {{domxref("WebGL2RenderingContext")}}  interface of the WebGL API specifies a three-dimensional texture image.

Syntax

texImage3D(target, level, internalformat, width, height, depth, border, format, type, srcData)
texImage3D(target, level, internalformat, width, height, depth, border, format, type, srcData, srcOffset)
texImage3D(target, level, internalformat, width, height, depth, border, format, type, source)
texImage3D(target, level, internalformat, width, height, depth, border, format, type, offset)

Parameters

The texture source can be provided in one of three ways: from an {{jsxref("ArrayBuffer")}}  (possibly shared) using srcData and srcOffset; from a DOM pixel source; or from gl.PIXEL_UNPACK_BUFFER using offset.

Return value

None ({{jsxref("undefined")}} ).

Examples

gl.texImage3D(
  gl.TEXTURE_3D,
  0, // level
  gl.RGBA, // internalFormat
  1, // width
  1, // height
  1, // depth
  0, // border
  gl.RGBA, // format
  gl.UNSIGNED_BYTE, // type
  new Uint8Array([0xff, 0x00, 0x00, 0x00]),
); // data

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN