Wrapper for a WebGL texture, containing all the information that was used to create it.
A WebGLTexture should never be exposed outside the WebGLRenderer, so the WebGLRenderer can handle context loss and other events without other systems having to be aware of it. Always use WebGLTextureWrapper instead.
new WebGLTextureWrapper(gl, mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, [pma], [forceSize], [flipY])
name | type | arguments | Default | description |
---|---|---|---|---|
gl | WebGLRenderingContext |
WebGL context the texture belongs to. |
||
mipLevel | number |
Mip level of the texture. |
||
minFilter | number |
Filtering of the texture. |
||
magFilter | number |
Filtering of the texture. |
||
wrapT | number |
Wrapping mode of the texture. |
||
wrapS | number |
Wrapping mode of the texture. |
||
format | number |
Which format does the texture use. |
||
pixels | object |
pixel data. |
||
width | number |
Width of the texture in pixels. |
||
height | number |
Height of the texture in pixels. |
||
pma | boolean | <optional> | true |
Does the texture have premultiplied alpha? |
forceSize | boolean | <optional> | false |
If |
flipY | boolean | <optional> | false |
Sets the |
Sets the UNPACK_FLIP_Y_WEBGL
flag the WebGL Texture uses during upload.
Whether to use the width and height properties, regardless of pixel dimensions.
Which format does the texture use.
The WebGL context this WebGLTexture belongs to.
Height of the texture in pixels.
Whether this is used as a RenderTexture.
Filtering of the texture.
Filtering of the texture.
Mip level of the texture.
Pixel data. This is the source data used to create the WebGLTexture.
Does the texture have premultiplied alpha?
The __SPECTOR_Metadata
property of the WebGLTexture
,
used to add extra data to the debug SpectorJS integration.
The WebGLTexture that this wrapper is wrapping.
This property could change at any time. Therefore, you should never store a reference to this value. It should only be passed directly to the WebGL API for drawing.
Width of the texture in pixels.
Wrapping mode of the texture.
Wrapping mode of the texture.
Creates a WebGLTexture from the given parameters.
This is called automatically by the constructor. It may also be called again if the WebGLTexture needs re-creating.
Deletes the WebGLTexture from the GPU, if it has not been already.
Updates the WebGLTexture from an updated source.
This should only be used when the source is a Canvas or Video element.
name | type | description |
---|---|---|
source | object |
The source to update the WebGLTexture with. |
width | number |
The new width of the WebGLTexture. |
height | number |
The new height of the WebGLTexture. |
flipY | boolean |
Should the WebGLTexture set |
wrapS | number |
The new wrapping mode for the WebGLTexture. |
wrapT | number |
The new wrapping mode for the WebGLTexture. |
minFilter | number |
The new minification filter for the WebGLTexture. |
magFilter | number |
The new magnification filter for the WebGLTexture. |
format | number |
The new format for the WebGLTexture. |