| Method | Description |
constructor |
creates a Buffer |
delete |
Destroys buffer |
initializeData |
Creates and initializes the buffer object’s data store. |
updateData |
Updates a subset of a buffer object’s data store. |
bind |
Binds a buffer to a given binding point (target). |
unbind |
bind(null) |
bindBase WebGL2 |
Binds a buffer to a given binding point (target) at a given index. |
unbindBase WebGL2 |
|
bindRange WebGL2 |
binds a range of a given WebGLBuffer to a given binding point (target) at a given index. |
unbindRange WebGL2 |
|
update |
Updates data in the buffer |
Wraps a WebGLBuffer. A WebGLBuffer is essentially a mechanism to upload memory buffers (attributes) to the GPU (the cost of which can vary depending on whether the system uses a unified memory architecture or not).
Creates a new WebGLBuffer. Also, for all properties set to a buffer, these properties are remembered so they’re optional for later calls.
import {Buffer} from 'luma.gl';
const buffer = new Buffer(gl, options);attribute
value is set in options then the buffer name will be used as attribute name.gl.ELEMENT_ARRAY_BUFFER, gl.ARRAY_BUFFER. Default is
gl.ARRAY_BUFFER.gl.FLOAT.stride parameter when calling gl.vertexAttribPointer. Default’s 0.offset parameter when calling gl.vertexAttribPointer. Default’s 0.gl.bufferData. Default’s gl.STATIC_DRAW.Set buffer values for the vertices of a triangle. The context of this example can be seen [here]http://uber.github.io/luma.gl/examples/lessons/1/).
program.setBuffer('triangle', {
attribute: 'aVertexPosition',
value: new Float32Array([0, 1, 0, -1, -1, 0, 1, -1, 0]),
size: 3
});