Helper class to create a webGL buffer
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext |
The current WebGL rendering context |
type |
gl.ARRAY_BUFFER | gl.ELEMENT_ARRAY_BUFFER |
@mat |
data |
ArrayBuffer | SharedArrayBuffer | ArrayBufferView |
an array of data |
drawType |
gl.STATIC_DRAW | gl.DYNAMIC_DRAW | gl.STREAM_DRAW |
Members
-
The WebGL buffer, created upon instantiation
-
The data in the buffer, as a typed array
-
The draw type of the buffer
-
The current WebGL rendering context
-
The type of the buffer
Methods
-
Binds the buffer
-
Destroys the buffer
-
Uploads the buffer to the GPU
Name Type Description data
ArrayBuffer | SharedArrayBuffer | ArrayBufferView an array of data to upload
offset
Number if only a subset of the data should be uploaded, this is the amount of data to subtract
dontBind
Boolean whether to bind the buffer before uploading it