Skip to main content
Version: Phaser v4.0.0-rc.6

WebGLVAOWrapper

Wrapper for a WebGL Vertex Array Object (VAO).

A WebGLVertexArrayObject should never be exposed outside the WebGLRenderer,

so the WebGLRenderer can handle context loss and other events without other

systems having to be aware of it. Always use WebGLVAOWrapper instead.

Constructor

new WebGLVAOWrapper(renderer, program, indexBuffer, attributeBufferLayouts)

Parameters

nametypeoptionaldescription
rendererPhaser.Renderer.WebGL.WebGLRendererNoThe WebGLRenderer instance that owns this wrapper.
programPhaser.Renderer.WebGL.Wrappers.WebGLProgramWrapperNoThe shader program that this VAO is associated with.
indexBufferPhaser.Renderer.WebGL.Wrappers.WebGLBufferWrapperNoThe index buffer used in this VAO, if any.
attributeBufferLayoutsArray.<Phaser.Renderer.WebGL.Wrappers.WebGLVertexBufferLayoutWrapper>NoThe vertex buffers containing attribute data for this VAO, alongside the relevant attribute layout.

Scope: static

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L9
Since: 4.0.0

Public Members

attributeBufferLayouts

attributeBufferLayouts: Array.<Phaser.Renderer.WebGL.Wrappers.WebGLVertexBufferLayoutWrapper>

Description:

The vertex buffers containing attribute data for this VAO,

alongside the relevant attribute layout.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L71
Since: 4.0.0


glState

glState: object

Description:

The state object used to bind this VAO.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L81
Since: 4.0.0


indexBuffer

indexBuffer: Phaser.Renderer.WebGL.Wrappers.WebGLBufferWrapper

Description:

The element array buffer used in this VAO, if any.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L61
Since: 4.0.0


program

program: Phaser.Renderer.WebGL.Wrappers.WebGLProgramWrapper

Description:

The shader program that this VAO is associated with.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L38
Since: 4.0.0


renderer

renderer: Phaser.Renderer.WebGL.WebGLRenderer

Description:

The WebGLRenderer instance that owns this wrapper.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L29
Since: 4.0.0


vertexArrayObject

vertexArrayObject: WebGLVertexArrayObject

Description:

The WebGLVertexArrayObject being wrapped by this class.

This property could change at any time.

Therefore, you should never store a reference to this value.

It should only be passed directly to the WebGL API for drawing.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L47
Since: 4.0.0


Public Methods

bind

<instance> bind()

Description:

Binds this WebGLVAOWrapper to the current WebGLRenderingContext.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L190
Since: 4.0.0


createResource

<instance> createResource()

Description:

Creates a new WebGLVertexArrayObject.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L95
Since: 4.0.0


destroy

<instance> destroy()

Description:

Destroys this WebGLVAOWrapper and removes all associated resources.

Source: src/renderer/webgl/wrappers/WebGLVAOWrapper.js#L201
Since: 4.0.0