Skip to main content

@luma.gl/constants

@luma.gl/constants publishes the typed GL constant table and WebGL parameter types used by luma.gl's WebGL adapter and low-level integrations.

When to use it

Most applications should prefer portable luma.gl string descriptors such as texture formats, primitive topologies, and render parameters. Import raw constants when integrating with a WebGL 2 API that requires numeric enums.

Quick start

import {GL, type GLBlendFunction} from '@luma.gl/constants';

const sourceFactor: GLBlendFunction = GL.SRC_ALPHA;
gl.blendFunc(sourceFactor, GL.ONE_MINUS_SRC_ALPHA);

Public API

  • GL contains WebGL numeric constants.
  • Exported GL* types describe texture targets, formats, primitives, data types, parameters, limits, extensions, and blend or stencil operations.

The same constant table is also documented in the WebGL constants reference.

Limits and compatibility

These constants describe WebGL integration. They do not imply that a portable Core API method accepts the corresponding numeric value, and they do not replace WebGPU enums.