luma.gl/docs/api-guide/README.md
2023-08-18 17:52:53 -04:00

1.8 KiB

API Overview

The luma.gl API is designed to expose the capabilities of the GPU and shader programming to web applications.

Core responsibilities for any GPU library are to enable applications to perform:

Portability

luma.gl enables the creation of portable applications that can run on top of either WebGPU, WebGL 2, or WebGL.

The @luma.gl/core module provides an abstract API for writing application code that works with both WebGPU and WebGL.

The @luma.gl/core module cannot be used on its own: it relies on being backed up by another module that implements the API. luma.gl provides adapters (implementations of the abstract API) through the @luma.gl/webgl and @luma.gl/webgpu modules.

Usage

Most luma.gl applications will:

  1. Create a Device class to access the GPU (either using WebGPU or WebGL).
  2. Use that device to upload data to the GPU in the form of Buffer and Texture objects.
  3. Create one or more RenderingPipeline objects from GLSL or WGSL shader code.
  4. Bind attribute buffers and bindings (textures, uniform buffers or uniforms).
  5. Start a render loop, and use a RenderPass to draw.