new Texture2D()
Properties:
| Name | Type | Description |
|---|---|---|
name |
The name of the texture. |
|
width |
The texture's width |
|
height |
The texture's height |
Methods
-
initEmpty(width, height, format, dataType)
-
Inits an empty texture.
Parameters:
Name Type Description widthThe width of the texture.
heightThe height of the texture.
formatTextureFormat The texture's format.
dataTypenumber The texture's data format.
-
uploadCompressedData(data, width, height, generateMips, internalFormat, mipLevel)
-
Uploads compressed data.
Parameters:
Name Type Description data* An typed array containing the initial data.
widthnumber The width of the texture.
heightnumber The height of the texture.
generateMipsboolean Whether or not a mip chain should be generated.
internalFormat* The texture's internal compression format.
mipLevelnumber The target mip map level. Defaults to 0. If provided, generateMips should be false.
-
uploadData(data, width, height, generateMips, format, dataType, mipLevel)
-
Initializes the texture with the given data.
Parameters:
Name Type Description data* An typed array containing the initial data.
widthnumber The width of the texture.
heightnumber The height of the texture.
generateMipsboolean Whether or not a mip chain should be generated.
formatTextureFormat The texture's format.
dataTypeDataType The texture's data format.
mipLevelnumber The target mip map level. Defaults to 0. If provided, generateMips should be false.
-
uploadImage(image, width, height, generateMips, format, dataType, mipLevel)
-
Initializes the texture with a given Image.
Parameters:
Name Type Description imageThe Image to upload to the texture
widthThe width of the texture.
heightThe height of the texture.
generateMipsWhether or not a mip chain should be generated.
formatTextureFormat The texture's format.
dataTypeDataType The texture's data format.
mipLevelnumber The target mip map level. Defaults to 0. If provided, generateMips should be false.