Overview

This is the main page of the reference documentation for luma.gl.

As a guide for getting started, for most applications, the Model, is likely the primary luma.gl class. It ties together many concepts in luma.gl and is a good place to start reading.

Core Classes

The basic building blocks of most applications.

Class Description
Model A renderable object with attributes and uniforms.
Geometry Holds attributes and drawType for a geometric primitive
Group Supports recursive travesal and matrix transformation
AnimationFrame render loop / app life cycle support
Object3D Base class, golds position, rotation, scale (TBD)

WebGL Classes

luma.gl is built on top of a set of JavaScript classes that wrap the WebGL API objects, making WebGL easier to work with in JavaScript.

Class/Module WebGL Type Description
createGLContext WebGLRenderingContext The main GL context.
Buffer WebGLBuffer Holds memory on GPU
FrameBuffer WebGLFrameBuffer Holds a framebuffer
RenderBuffer WebGLRenderBuffer Holds a renderbuffer
Program WebGLProgram Shaders, attributes and uniforms.
Shader WebGLShader Shaders, attributes and uniforms.
Texture2D WebGLTexture(GL.TEXTURE_2D) Holds a loaded texture
TextureCube WebGLTexture(GL.TEXTURE_CUBE) Holds a loaded texture
Texture2DArray WebGL2 WebGLTexture(GL.TEXTURE_2D_ARRAY) Holds a loaded texture
Texture3D WebGL2 WebGLTexture(GL.TEXTURE_3D) Holds a loaded texture
Query WebGL2/ext WebGLQuery Occlusion, Tranform Feedback and Performance Queries
Sampler WebGL2 WebGLSampler Stores texture sampling params
Sync WebGL2 WebGLSync Synchronize GPU and app.
TransformFeedback WebGL2 WebGLTransformFeedback Capture Vertex Shader output
VertexArrayObject WebGL2/ext WebGLVertexArrayObject Save global vertex attribute array.
VertexAttributes gl.vertexAttrib* Manipulates shader attributes (TBD merge with VAO?)
VertexAttributes gl.vertexAttrib* Manipulates shader attributes

WebGL2 Classes

luma.gl is designed to facilitate use of the latest WebGL features, so wrapper classes are provided for the new objects in WebGL2.

Class/Module WebGL Type Description
Query WebGLQuery Occlusion, performance queries
Sampler WebGLSampler Stores texture sampling params
Sync WebGLSync Synchronize GPU and app.
TransformFeedback WebGLTransformFeedback Capture Vertex Shader output
VertexArrayObject WebGLVertexArrayObject Save global vertex attribute array.

WebGL Extensions

luma.gl uses WebGL Extensions to make WebGL 2 features (conditionally) available under WebGL1 and to enable an improved debugging/profiling experience.

Supporting Modules

Module Description
Math Small math library, Vec3, Vec4, Mat4, Quat
IO Node.js loader support. Also enables using streams in browser.

Geometric Primitives

A geometry holds a set of attributes (native JavaScript arrays) (vertices, normals, texCoords, indices) and a drawType.

Class Description
Geometry Base class, holds vertex attributes and drawType
ConeGeometry Vertex attributes for a cone
CubeGeometry Vertex attributes for a cube
IcoSphereGeometry Vertex attributes for an icosahedron
PlaneGeometry Vertex attributes for a plane
SphereGeometry Vertex attributes for a sphere

Geometric Primitives

A geometry holds a set of attributes (native JavaScript arrays) (vertices, normals, texCoords, indices) and a drawType.

Class Description
Geometry Base class, holds vertex attributes and drawType
ConeGeometry Vertex attributes for a cone
CubeGeometry Vertex attributes for a cube
IcoSphereGeometry Vertex attributes for an icosahedron
PlaneGeometry Vertex attributes for a plane
SphereGeometry Vertex attributes for a sphere

It is straightforward to use other primitives, e.g. from npm modules. As long as you have a number of attributes you can wrap them in a Geometry or set them directly on a Model or a Program.

Scene Graph

A basic hierarchy of 3D objects with positioning, grouping, traversal and scene support.

Class Description
Object3D Base class, golds position, rotation, scale
Group Supports recursive travesal and matrix transformation
Scene A Group with settings that can be rendered using default shaders

Addons

Functions that are not considered a core part of the library are collected in the addons folder. These are not guaranteed to remain in future versions of the library, but in such cases they can be copied into the application if still useful.

Class Description
Event Event handling

Deprecated Classes

Will be removed in next major version of luma.gl

Class Description
PerspectiveCamera Generates uniform matrices for perspective viewing
OrthoCamera Generates uniform matrices for orthographic viewing
Scene A Group with settings that can be rendered using default shaders