Class: Texture

Texture

Helper class to create a WebGL Texture

new PIXI.glCore.Texture(gl, width, height, format, type)

Name Type Description
gl WebGLRenderingContext

The current WebGL context

width number

the width of the texture

height number

the height of the texture

format number

the pixel format of the texture. defaults to gl.RGBA

type number

the gl type of the texture. defaults to gl.UNSIGNED_BYTE

Members

formatNumber

The pixel format of the texture. defaults to gl.RGBA

glWebGLRenderingContext

The current WebGL rendering context

heightNumber

The height of texture

premultiplyAlphaBoolean

Set to true to enable pre-multiplied alpha

textureWebGLTexture

The WebGL texture

typeNumber

The gl type of the texture. defaults to gl.UNSIGNED_BYTE

widthNumber

The width of texture

Methods

staticPIXI.glCore.Texture.fromData(gl, data, width, height)

Name Type Description
gl WebGLRenderingContext

The current WebGL context

data TypedArray

the data to upload to the texture

width number

the new width of the texture

height number

the new height of the texture

staticPIXI.glCore.Texture.fromSource(gl, source, premultiplyAlpha)

Name Type Description
gl WebGLRenderingContext

The current WebGL context

source HTMLImageElement | ImageData

the source image of the texture

premultiplyAlpha Boolean

If we want to use pre-multiplied alpha

Binds the texture

Name Type Description
location

Destroys this texture

Enables linear filtering

Enables mipmapping

Enables nearest neighbour interpolation

Enables clamping on the texture so WebGL will not repeat it

Name Type Description
linear Boolean

if we want to use linear filtering or nearest neighbour interpolation

Name Type Description
linear Boolean

if we want to use linear filtering or nearest neighbour interpolation

Unbinds the texture

Uploads this texture to the GPU

Name Type Description
source HTMLImageElement | ImageData | HTMLVideoElement

the source image of the texture

Use a data source and uploads this texture to the GPU

Name Type Description
data TypedArray

the data to upload to the texture

width number

the new width of the texture

height number

the new height of the texture