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

bufferWebGLBuffer

The WebGL buffer, created upon instantiation

dataArrayBuffer SharedArrayBuffer ArrayBufferView

The data in the buffer, as a typed array

drawTypegl.STATIC_DRAW gl.DYNAMIC_DRAW gl.STREAM_DRAW

The draw type of the buffer

glWebGLRenderingContext

The current WebGL rendering context

typegl.ARRAY_BUFFER gl.ELEMENT_ARRAY_BUFFER

The type of the buffer

Methods

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