LogoPixi’VN
pixi-jsClasses

Class: GlBufferSystem

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:26

System plugin to the renderer to manage buffers.

WebGL uses Buffers as a way to store objects to the GPU. This system makes working with them a lot easier.

Buffers are used in three main places in WebGL

  • geometry information
  • Uniform information (via uniform buffer objects - a WebGL 2 only feature)
  • Transform feedback information. (WebGL 2 only feature)

This system will handle the binding of buffers to the GPU as well as uploading them. With this system, you never need to work directly with GPU buffers, but instead work with the Buffer class.

Advanced

Implements

Constructors

Constructor

> new GlBufferSystem(renderer): GlBufferSystem

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:45

Parameters

renderer

WebGLRenderer

The renderer this System works for.

Returns

GlBufferSystem

Properties

_gl

> _gl: WebGL2RenderingContext

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:33

Internal


_managedBuffers

> protected _managedBuffers: GCManagedHash<Buffer>

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:34

Methods

bind()

> bind(buffer): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:55

This binds specified buffer. On first run, it will create the webGL buffers for the context too

Parameters

buffer

Buffer

the buffer to bind to the renderer

Returns

void


bindBufferBase()

> bindBufferBase(glBuffer, index): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:63

Binds an uniform buffer to at the given index.

A cache is used so a buffer will not be bound again if already bound.

Parameters

glBuffer

GlBuffer

the buffer to bind

index

number

the base index to bind it to.

Returns

void


bindBufferRange()

> bindBufferRange(glBuffer, index?, offset?, size?): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:75

Binds a buffer whilst also binding its range. This will make the buffer start from the offset supplied rather than 0 when it is read.

Parameters

glBuffer

GlBuffer

the buffer to bind

index?

number

the base index to bind at, defaults to 0

offset?

number

the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc

size?

number

the size to bind at (this is blocks of 256).

Returns

void


contextChange()

> protected contextChange(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:49

Sets up the renderer context and necessary buffers.

Returns

void


createGLBuffer()

> protected createGLBuffer(buffer): GlBuffer

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:92

creates and attaches a GLBuffer object tied to the current context.

Parameters

buffer

Buffer

Returns

GlBuffer


destroyAll()

> destroyAll(contextLost?): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:85

dispose all WebGL resources of all managed buffers

Parameters

contextLost?

boolean

Returns

void


freeLocationForBufferBase()

> freeLocationForBufferBase(glBuffer): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:65

Parameters

glBuffer

GlBuffer

Returns

number


getGlBuffer()

> getGlBuffer(buffer): GlBuffer

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:50

Parameters

buffer

Buffer

Returns

GlBuffer


getLastBindBaseLocation()

> getLastBindBaseLocation(glBuffer): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:66

Parameters

glBuffer

GlBuffer

Returns

number


nextBindBase()

> nextBindBase(hasTransformFeedback): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:64

Parameters

hasTransformFeedback

boolean

Returns

void


onBufferUnload()

> protected onBufferUnload(buffer, contextLost?): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:86

Parameters

buffer

Buffer

contextLost?

boolean

Returns

void


resetState()

> resetState(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:93

Returns

void


updateBuffer()

> updateBuffer(buffer): GlBuffer

Defined in: node_modules/pixi.js/lib/rendering/renderers/gl/buffer/GlBufferSystem.d.ts:80

Will ensure the data in the buffer is uploaded to the GPU.

Parameters

buffer

Buffer

the buffer to update

Returns

GlBuffer