mirror of
https://github.com/visgl/luma.gl.git
synced 2025-12-08 17:36:19 +00:00
1.4 KiB
1.4 KiB
VertexArrayObject (EXT)
A vertex array object is a WebGL object that stores all of the state needed to supply vertex data. While VertexArrayObjects are not available in basic WebGL1 environments, they are available by default in WebGL2 and via a commonly supported extension under WebGL1.
For more information, see OpenGL Wiki.
Usage
Creating a VertexArrayObject
import {VertexArrayObject} from 'luma.gl';
if (VertexArrayObject.isSupported(gl)) {
return new VertexArrayObject(gl)
}
Adding attributes to a VertexArrayObject
const vertexArrayObject = new VertexArrayObject(gl);
vertexArrayObject.bind();
vertexArrayObject.unbind();
Deleting a VertexArrayObject
vertexArrayObject.delete();
Methods
VertexArrayObject inherits from Resource.
isSupported (static method)
Parameters:
- gl (WebGLRenderingContext) - gl context Returns:
- Boolean - true if VertexArrayObjects are supported in the current environment.
constructor
Creates a new VertexArrayObject
Parameters:
- gl (WebGLRenderingContext) - gl context
Remarks
- The raw WebGL APIs for are working with
WebGLVertexArrayObjects are exposed differently in the WebGL1 extension and WebGL2. As always, the luma.glVertexArrayObjectclass transparently handles the necessary API detection and selection.