createBuffer()
ts
function createBuffer(
gl,
data,
usage?,
type?
): WebGLBuffer;Defined in: createBuffer.js:13
Creates a buffer and uploads data to it. The buffer is left bound to type.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
gl | WebGL2RenderingContext | undefined | The WebGL2 context. |
data | ArrayBufferView<ArrayBufferLike> | undefined | The contents. |
usage? | number | gl.STATIC_DRAW | How it will be used, e.g. gl.DYNAMIC_DRAW. Defaults to gl.STATIC_DRAW. |
type? | number | gl.ARRAY_BUFFER | The target to bind it to. Defaults to gl.ARRAY_BUFFER. |
Returns
WebGLBuffer