Class: Texture

Texture

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

Helper class to create a WebGL Texture

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

format Number

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

gl WebGLRenderingContext

The current WebGL rendering context

height Number

The height of texture

mipmap Boolean

If mipmapping was used for this texture, enable and disable with enableMipmap()

premultiplyAlpha Boolean

Set to true to enable pre-multiplied alpha

texture WebGLTexture

The WebGL texture

type Number

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

width Number

The width of texture

Methods

PIXI.glCore.Texture.fromData (gl, data, width, height) static

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

PIXI.glCore.Texture.fromSource (gl, source, premultiplyAlpha) static

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

bind (location)

Binds the texture

Name Type Description
location

destroy ()

Destroys this texture

enableLinearScaling ()

Enables linear filtering

enableMipmap ()

Enables mipmapping

enableNearestScaling ()

Enables nearest neighbour interpolation

enableWrapClamp ()

Enables clamping on the texture so WebGL will not repeat it

enableWrapRepeat ()

Enable tiling on the texture

magFilter (linear)

Name Type Description
linear Boolean

if we want to use linear filtering or nearest neighbour interpolation

minFilter (linear)

Name Type Description
linear Boolean

if we want to use linear filtering or nearest neighbour interpolation

unbind ()

Unbinds the texture

upload (source)

Uploads this texture to the GPU

Name Type Description
source HTMLImageElement | ImageData | HTMLVideoElement

the source image of the texture

uploadData (data, width, height)

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