Class Texture<MipType>

An array of data that can be randomly accessed in a shader program.

Type Parameters

  • MipType extends Mip

Hierarchy

Constructors

  • Creates a texture.

    Type Parameters

    • MipType extends Mip

    Parameters

    • context: Context

      The WebGL2 rendering context of the texture.

    • target: TextureTarget

      The binding point of the texture.

    • faces: Map<MipmapTarget, Mipmap<MipType>> = ...

      The faces of the texture.

    • magFilter: TextureMagFilter = TextureMagFilter.NEAREST

      The magnification filter to use on the texture.

    • minFilter: TextureMinFilter = TextureMinFilter.NEAREST

      The minification filter to use on the texture.

    • wrapSFunction: TextureWrapFunction = TextureWrapFunction.REPEAT

      The function to use when wrapping the texture across the S-axis.

    • wrapTFunction: TextureWrapFunction = TextureWrapFunction.REPEAT

      The function to use when wrapping the texture across the T-axis.

    Returns Texture<MipType>

Properties

context: Context

The rendering context of this texture.

faces: Map<MipmapTarget, Mipmap<MipType>>

The faces of this texture.

internal: WebGLTexture

The WebGL texture represented by this object.

The binding point of this texture.

Accessors

Methods

  • Assigns this texture to a texture unit and binds it to its binding point.

    Parameters

    • textureUnit: number

      The texture unit.

    Returns void

  • Updates the texels of this texture.

    Returns boolean

    Whether any updates were performed.

  • Executes the given function with this texture bound, then re-binds the previously-bound texture.

    Type Parameters

    • T

    Parameters

    • f: ((texture) => T)

      The function to execute.

        • (texture): T
        • Parameters

          Returns T

    Returns T

    The return value of the executed function.

  • Assigns a texture unit as active.

    Parameters

    • context: Context

      The rendering context.

    • textureUnit: number

      The texture unit.

    Returns void

  • Binds a framebuffer to a binding point.

    Parameters

    • context: Context

      The rendering context of the framebuffer.

    • target: TextureTarget

      The target binding point.

    • framebuffer: null | WebGLTexture

      The framebuffer.

    Returns void

  • Gets the internal representation of the currently-bound texture.

    Parameters

    • context: Context

      The context that the texture is bound to.

    • target: TextureTarget

      The target that the texture is bound to.

    Returns null | WebGLTexture

    The currently-bound texture.

Generated using TypeDoc