Skip to main content

TextureLoader

Manages loading image sources into webgl textures, a unique id is associated with all sources

Index

Constructors

constructor

  • new TextureLoader(gl: WebGL2RenderingContext, _garbageCollector?: { collectionInterval: number; garbageCollector: GarbageCollector }): TextureLoader

Properties

publicstaticfiltering

filtering: ImageFiltering = ImageFiltering.Blended

Sets the default filtering for the Excalibur texture loader, default ImageFiltering.Blended

publicstaticwrapping

wrapping: ImageWrapConfiguration = ...

Methods

publicdelete

publicdispose

  • dispose(): void
  • Returns void

publicget

  • Get the WebGL Texture from a source image


    Parameters

    Returns WebGLTexture

publichas

  • Returns whether a source image has been loaded as a texture


    Parameters

    Returns boolean

publicload

  • Loads a graphic into webgl and returns it's texture info, a webgl context must be previously registered


    Parameters

    • image: HTMLImageSource

      Source graphic

    • optionaloptions: ImageSourceOptions

      {ImageSourceOptions} Optionally configure the ImageFiltering and ImageWrapping mode to apply to the loaded texture

    • forceUpdate: boolean = false

      Optionally force a texture to be reloaded, useful if the source graphic has changed

    Returns WebGLTexture

publicstaticcheckImageSizeSupportedAndLog

  • Takes an image and returns if it meets size criteria for hardware


    Parameters

    Returns boolean

    if the image will be supported at runtime