Options
All
  • Public
  • Public/Protected
  • All
Menu

Generic GPU texture store, wrapping WebGLTexture.

Hierarchy

  • default
    • Texture

Index

Properties

ready: Promise<void>

How supplied texture data is interpreted.

For non-compressed textures, this means included channels and channel formats. See TextureFormat.

For compressed textures, this is the actual storage format. See CompressedTextureStorageFormat

isCompressed: boolean = false
isPreallocated: boolean = true
minLod: number
maxLod: number
width: number

Texture width in pixels.

height: number

Texture height in pixels.

Methods

  • uploadLevelSync(target: TextureCubeFace | TextureBindingPoint, level: number, width: number, height: number, type: BufferDataType | TextureDataType, srcData: ArrayBufferView): void
  • bindSync(): boolean
  • If ready, binds the texture to the relevant binding point.

    Returns boolean

    true if the texture has been successfully bound, false otherwise.

  • Uploads an array of pixels to the GPU.

    example

    Uploading a 2x2px red/black checkerboard texture and a 1x1px dark red mipmap.

    import { Texture, BufferDataType } from '@gdgt/webgl';


    const myTexture = new Texture( {
    width: 2,
    height: 2,
    levels: 2,
    } );

    await myTexture.uploadPixels(
    {
    0: new Uint8Array([
    255, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 255, 0, 0, 255,
    ]),
    1: new Uint8Array([128, 0, 0, 255]),
    },
    BufferDataType.unsignedByte,
    );

    Parameters

    Returns Promise<void>

Constructors

Generated using TypeDoc