luma.gl

Texture3D (WebGL2)

3D textures hold basic volumetric textures and can be thought of 3-dimentional arrays with a width, height and depth. They hold image memory of a certain format and size, determined at initialization time. They can be sampled in shaders using the texture function with a 3D texture coordinate.

Most texture related functionality is implemented by and documented on the Texture base class. For additional information, see OpenGL Wiki.

Usage

Create a new 3D texture

if (Texture3D.isSupported()) {
  texture3D = new Texture3D(gl, {...});
}

Members

Methods

Texture3D is a subclass of the Texture and Resource classes and inherit all methods and members of those classes. Note that setSubImageData is not currently supported for 3D textures.

Texture3D.isSupported(gl)

Returns true if the context supports creation of Texture3Ds.

constructor

new Texture3D(gl, {parameters});

const texture = new Texture3D(gl, {
  width: TEXTURE_DIMENSIONS,
  height: TEXTURE_DIMENSIONS,
  depth: TEXTURE_DIMENSIONS,
  data: textureData,
  format: gl.RED,
  dataFormat: gl.R8
});

Limits