luma.gl

Resource Class

Overview

The Resource class is the base class of all WebGL resource classes (e.g. Buffer, Texture, etc.)

Usage

Resources must be created through subclasses, e.g.

const resource = new Buffer(gl);

Deleting a resource

const resource = new Buffer(gl);
resource.delete();

Getting parameters

const resource = new Texture2d(gl);
resource.getParameters(); // Returns object with values keyed by GL constants.
resource.getParameters({keys: true}); // Returns object with keys and enum values converted to strings.

Methods

constructor

delete

getParameter(pname)

Gets a given parameter from the resource.

getParameters(parameters)

Gets list of parameters from the resource (or all parameters).

If the special parameter keys is set to true, keys and enumerations will be converted to strings.

Properties

gl

The WebGL context is stored on the object.

id

Stores a string id, helpful for printing and debugging.

userData

An empty object to which the application can add keys and values. Note that the resource object. itself is sealed to prevent additional key being added, and any keys and values added directly to the underlying WebGL object will be lost during WebGL context loss.