luma.gl

Overview

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

As a guide for getting started, for most applications, the Model, Scene and PerspectiveCamera classes are likely the primary luma.gl classes. These tie together a lot of the concepts in luma.gl and are good places to start reading.

Core Classes


These classes are the basic building blocks of most applications.

Class Description
Model A renderable object with Geometry, Textures, and uniforms.
Geometry Holds attributes and drawType for a geometric primitive
PerspectiveCamera Generates uniform matrices for perspective viewing
OrthoCamera Generates uniform matrices for orthographic viewing

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

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

WebGL Classes


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

Class/Module WebGL Type Description
createGLContext WebGLRenderingContext The main GL context.
Program WebGLProgram Shaders, attributes and uniforms.
Buffer WebGLBuffer Holds memory on GPU
Texture WebGLTexture Holds a loaded texture
FrameBuffer WebGLFrameBuffer Holds a framebuffer
RenderBuffer WebGLRenderBuffer Holds a renderbuffer
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
Event Event handling
IO Loader support
Fx render loop support (or use window.requestAnimationFrame)

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.