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

    A wrapper for the WebGLRenderingContext's texture units. It tracks which textures are bound to which units, and provides binding utilities.

    Index

    Constructors

    Properties

    renderer: WebGLRenderer

    The WebGLRenderer instance that owns this wrapper.

    unitIndices: number[]

    List of the indexes of available texture units. Used in setting uniforms.

    The list of texture units available to the WebGLRenderingContext.

    Methods

    • Binds a texture to a texture unit.

      This will change the active texture unit to the given unit, unless forceActive is false.

      This should be the only way to bind a texture to a unit.

      Parameters

      • texture: WebGLTextureWrapper

        The texture to bind, or null to unbind the unit.

      • unit: number

        The texture unit to bind the texture to.

      • Optionalforce: boolean

        If true, it will bind the texture even if it is already bound. Default false.

      • OptionalforceActive: boolean

        If true, it will change the active texture unit to the given unit even if it is already active. Otherwise, it will only change the active texture unit if it is not already active. Default true.

      Returns void

    • Set specific texture units to specific textures.

      The active texture unit may change to accommodate the bindings.

      Parameters

      • textures: WebGLTextureWrapper[]

        The textures to bind. Null values will be unbound. Undefined values will be skipped.

      • Optionalforce: boolean

        If true, it will bind all textures, even if they are already bound. Default false.

      Returns void

    • Initializes the texture units to null. The active texture unit will be 0 after this runs.

      This populates every texture unit with a 1x1 texture. This stops WebGL errors on MacOS. These textures are not wrapped, and are not intended to be used, so the texture units are recorded as null.

      Returns void

    • Unbinds all textures from all texture units. This will change the active texture unit to 0.

      Returns void