phaser - v4.0.0-rc.4
    Preparing search index...

    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.

    Index

    Constructors

    Properties

    compileTimeMs: number

    The time taken to compile this program, in milliseconds.

    compiling: boolean

    Whether this program is currently being compiled. This will always be false, unless parallel shader compilation is enabled via config.render.skipUnreadyShaders.

    fragmentSource: string

    The fragment shader source code as a string.

    glAttributeBuffer: WebGLBuffer

    The buffer which this program is using for its attributes.

    glAttributeNames: Map<string, number>

    Map of attribute names to their indexes in glAttributes.

    glAttributes: { location: number; name: string; size: number; type: number }[]

    The attribute state of this program.

    These represent the actual state in WebGL, and are only updated when the program is used to draw.

    The WebGL state necessary to bind this program.

    This is used internally to accelerate state changes.

    glUniforms: Map<string, WebGLUniform>

    The uniform state of this program.

    These represent the actual state in WebGL, and are only updated when the program is used to draw.

    renderer: WebGLRenderer

    The WebGLRenderer instance that owns this wrapper.

    uniformRequests: Map<string, any>

    Requests to update the uniform state. Set a request by name to a new value. These are only processed when the program is used to draw.

    vertexSource: string

    The vertex shader source code as a string.

    webGLProgram: WebGLProgram

    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.

    Methods

    • Set this program as the active program in the WebGL context.

      This will also update the uniform state.

      Returns void

    • Poll shader compilation status, and complete the program if it is ready. This is only called if skipUnreadyShaders is enabled and the KHR_parallel_shader_compile extension is available.

      Returns void

    • 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.

      Returns void

    • Set a uniform value for this WebGLProgram.

      This method doesn't set the WebGL value directly. Instead, it adds a request to the uniformRequests map. These requests are processed when the program is used to draw.

      Parameters

      • name: string

        The name of the uniform.

      • value: number | number[] | Float32Array<ArrayBufferLike> | Int32Array<ArrayBufferLike>

        The value to set.

      Returns void