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

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

    A WebGLTexture 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 WebGLTextureWrapper instead.

    Index

    Constructors

    • Parameters

      • renderer: WebGLRenderer

        The WebGLRenderer instance that owns this wrapper.

      • mipLevel: number

        Mip level of the texture.

      • minFilter: number

        Filtering of the texture.

      • magFilter: number

        Filtering of the texture.

      • wrapT: number

        Wrapping mode of the texture.

      • wrapS: number

        Wrapping mode of the texture.

      • format: number

        Which format does the texture use.

      • pixels: object

        pixel data.

      • width: number

        Width of the texture in pixels.

      • height: number

        Height of the texture in pixels.

      • Optionalpma: boolean

        Does the texture have premultiplied alpha? Default true.

      • OptionalforceSize: boolean

        If true it will use the width and height passed to this method, regardless of the pixels dimension. Default false.

      • OptionalflipY: boolean

        Sets the UNPACK_FLIP_Y_WEBGL flag the WebGL Texture uses during upload. Default true.

      Returns WebGLTextureWrapper

    Properties

    batchUnit: number

    The texture unit this texture will be bound to in the current rendering batch.

    This should be set by the batcher. It is a quick way to tell whether this texture has been included in the batch. If it is -1, it has not.

    flipY: boolean

    Sets the UNPACK_FLIP_Y_WEBGL flag the WebGL Texture uses during upload.

    forceSize: boolean

    Whether to use the width and height properties, regardless of pixel dimensions.

    format: number

    Which format does the texture use.

    height: number

    Height of the texture in pixels.

    isRenderTexture: boolean

    Whether this is used as a RenderTexture.

    magFilter: number

    Filtering of the texture.

    minFilter: number

    Filtering of the texture.

    mipLevel: number

    Mip level of the texture.

    pixels: object

    Pixel data. This is the source data used to create the WebGLTexture.

    pma: boolean

    Does the texture have premultiplied alpha?

    renderer: WebGLRenderer

    The WebGLRenderer this WebGLTexture belongs to.

    spectorMetadata: object

    The __SPECTOR_Metadata property of the WebGLTexture, used to add extra data to the debug SpectorJS integration.

    webGLTexture: WebGLTexture

    The WebGLTexture that this wrapper is wrapping.

    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.

    width: number

    Width of the texture in pixels.

    wrapS: number

    Wrapping mode of the texture.

    wrapT: number

    Wrapping mode of the texture.

    Methods

    • Creates a WebGLTexture from the given parameters.

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

      Returns void

    • Deletes the WebGLTexture from the GPU, if it has not been already.

      Returns void

    • Resizes the WebGLTexture to the new dimensions. This will destroy the contents of the texture.

      Parameters

      • width: number

        The new width of the WebGLTexture.

      • height: number

        The new height of the WebGLTexture.

      Returns void

    • Updates the WebGLTexture from an updated source.

      This should only be used when the source is a Canvas or Video element.

      Because textures usually change into something complex and unique, this method forces all properties to update without checking.

      Parameters

      • source: object

        The source to update the WebGLTexture with.

      • width: number

        The new width of the WebGLTexture.

      • height: number

        The new height of the WebGLTexture.

      • flipY: boolean

        Should the WebGLTexture set UNPACK_MULTIPLY_FLIP_Y?

      • wrapS: number

        The new wrapping mode for the WebGLTexture.

      • wrapT: number

        The new wrapping mode for the WebGLTexture.

      • minFilter: number

        The new minification filter for the WebGLTexture.

      • magFilter: number

        The new magnification filter for the WebGLTexture.

      • format: number

        The new format for the WebGLTexture.

      Returns void