Class: Buffer

Buffer

new PIXI.glCore.Buffer (gl, type, data, drawType)

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

buffer WebGLBuffer

The WebGL buffer, created upon instantiation

data ArrayBuffer | SharedArrayBuffer | ArrayBufferView

The data in the buffer, as a typed array

drawType gl.STATIC_DRAW | gl.DYNAMIC_DRAW | gl.STREAM_DRAW

The draw type of the buffer

gl WebGLRenderingContext

The current WebGL rendering context

type gl.ARRAY_BUFFER | gl.ELEMENT_ARRAY_BUFFER

The type of the buffer

Methods

bind ()

Binds the buffer

destroy ()

Destroys the buffer

upload (data, offset, dontBind)

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