Phaser API Documentation

  Version: 
Filter

Wrapper for a WebGL program, containing all the information that was used to create it.

A WebGLProgram 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 WebGLProgramWrapper instead.

Constructor:

new WebGLProgramWrapper(gl, vertexSource, fragmentShader)

Parameters:

name type description
gl WebGLRenderingContext

The WebGLRenderingContext to create the WebGLProgram for.

vertexSource string

The vertex shader source code as a string.

fragmentShader string

The fragment shader source code as a string.

Members

fragmentSource: string
Focus
Focus

Description:

The fragment shader source code as a string.

Type:
string
Focus
Focus
gl: WebGLRenderingContext
Focus
Focus

Description:

The WebGLRenderingContext that owns this WebGLProgram.

Type:
WebGLRenderingContext
Focus
Focus
vertexSource: string
Focus
Focus

Description:

The vertex shader source code as a string.

Type:
string
Focus
Focus
<nullable> webGLProgram: WebGLProgram
Focus
Focus

Description:

The WebGLProgram 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.

Type:
WebGLProgram
Default: null
Focus
Focus

Methods

createResource()
Focus
Focus

Description:

Creates a WebGLProgram from the given vertex and fragment shaders.

This is called automatically by the constructor. It may also be called again if the WebGLProgram needs re-creating.

Focus
Focus
destroy()
Focus
Focus

Description:

Remove this WebGLProgram from the GL context.

Focus
Focus