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
-
formatNumber
-
The pixel format of the texture. defaults to gl.RGBA
-
glWebGLRenderingContext
-
The current WebGL rendering context
-
heightNumber
-
The height of texture
-
mipmapBoolean
-
If mipmapping was used for this texture, enable and disable with enableMipmap()
-
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 glWebGLRenderingContext The current WebGL context
dataTypedArray the data to upload to the texture
widthnumber the new width of the texture
heightnumber the new height of the texture
-
staticPIXI.glCore.Texture.fromSource(gl, source, premultiplyAlpha)
-
Name Type Description glWebGLRenderingContext The current WebGL context
sourceHTMLImageElement | ImageData the source image of the texture
premultiplyAlphaBoolean 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 linearBoolean if we want to use linear filtering or nearest neighbour interpolation
-
minFilter(linear)
-
Name Type Description linearBoolean 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 sourceHTMLImageElement | 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 dataTypedArray the data to upload to the texture
widthnumber the new width of the texture
heightnumber the new height of the texture