docs/android/dokka/filament-android/com.google.android.filament/-texture/index.md
//filament-android/com.google.android.filament/Texture
open class Texture
Texture
The Texture class supports:
A Texture object is created using the Texture.Builder and destroyed by calling destroyTexture. They're bound using setParameter. ```kotlin
Engine engine = Engine.create();
Material material = new Material.Builder() .payload( ... ) .build(ending);
MaterialInstance mi = material.getDefaultInstance();
Texture texture = new Texture.Builder() .width(64) .height(64) .build(engine);
texture.setImage(engine, 0, new Texture.PixelBufferDescriptor( ... ));
mi.setParameter("parameterName", texture, new TextureSampler());
#### See also
| |
|---|
| setImage |
| [Texture.PixelBufferDescriptor](-pixel-buffer-descriptor/index.md) |
| [MaterialInstance](../-material-instance/set-parameter.md) |
## Constructors
| | |
|---|---|
| [Texture](-texture.md) | [main]
constructor(nativeTexture: [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-long/index.html)) |
## Types
| Name | Summary |
|---|---|
| [Builder](-builder/index.md) | [main]
open class [Builder](-builder/index.md)
Use `Builder` to construct a `Texture` object instance. |
| [CompressedFormat](-compressed-format/index.md) | [main]
enum [CompressedFormat](-compressed-format/index.md)
Compressed data types for use with [PixelBufferDescriptor](-pixel-buffer-descriptor/index.md) |
| [CubemapFace](-cubemap-face/index.md) | [main]
enum [CubemapFace](-cubemap-face/index.md)
Cubemap faces |
| [Format](-format/index.md) | [main]
enum [Format](-format/index.md)
Pixel color format |
| [InternalFormat](-internal-format/index.md) | [main]
enum [InternalFormat](-internal-format/index.md)
Internal texel formats These formats are used to specify a texture's internal storage format. |
| [PixelBufferDescriptor](-pixel-buffer-descriptor/index.md) | [main]
open class [PixelBufferDescriptor](-pixel-buffer-descriptor/index.md)
A descriptor to an image in main memory, typically used to transfer image data from the CPU to the GPU. |
| [PrefilterOptions](-prefilter-options/index.md) | [main]
open class [PrefilterOptions](-prefilter-options/index.md)
Options of [generatePrefilterMipmap](generate-prefilter-mipmap.md) |
| [Sampler](-sampler/index.md) | [main]
enum [Sampler](-sampler/index.md)
Type of sampler |
| [Swizzle](-swizzle/index.md) | [main]
enum [Swizzle](-swizzle/index.md)
Texture swizzling channels |
| [Type](-type/index.md) | [main]
enum [Type](-type/index.md)
Pixel data type |
| [Usage](-usage/index.md) | [main]
open class [Usage](-usage/index.md)
A bitmask to specify how the texture will be used. |
## Properties
| Name | Summary |
|---|---|
| [BASE_LEVEL](-b-a-s-e_-l-e-v-e-l.md) | [main]
val [BASE_LEVEL](-b-a-s-e_-l-e-v-e-l.md): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html) = 0 |
## Functions
| Name | Summary |
|---|---|
| [generateMipmaps](generate-mipmaps.md) | [main]
open fun [generateMipmaps](generate-mipmaps.md)(engine: [Engine](../-engine/index.md))
Generates all the mipmap levels automatically. |
| [generatePrefilterMipmap](generate-prefilter-mipmap.md) | [main]
open fun [generatePrefilterMipmap](generate-prefilter-mipmap.md)(engine: [Engine](../-engine/index.md), buffer: [Texture.PixelBufferDescriptor](-pixel-buffer-descriptor/index.md), faceOffsetsInBytes: [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-array/index.html)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)>, options: [Texture.PrefilterOptions](-prefilter-options/index.md))
Creates a reflection map from an environment map. |
| [getDepth](get-depth.md) | [main]
open fun [getDepth](get-depth.md)(level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Queries the number of layers of given level of this texture has. |
| [getFormat](get-format.md) | [main]
open fun [getFormat](get-format.md)(): [Texture.InternalFormat](-internal-format/index.md) |
| [getHeight](get-height.md) | [main]
open fun [getHeight](get-height.md)(level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Queries the height of a given level of this texture. |
| [getLevels](get-levels.md) | [main]
open fun [getLevels](get-levels.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html) |
| [getMaxArrayTextureLayers](get-max-array-texture-layers.md) | [main]
open fun [getMaxArrayTextureLayers](get-max-array-texture-layers.md)(engine: [Engine](../-engine/index.md)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html) |
| [getMaxTextureSize](get-max-texture-size.md) | [main]
open fun [getMaxTextureSize](get-max-texture-size.md)(engine: [Engine](../-engine/index.md), type: [Texture.Sampler](-sampler/index.md)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html) |
| [getNativeObject](get-native-object.md) | [main]
open fun [getNativeObject](get-native-object.md)(): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-long/index.html) |
| [getTarget](get-target.md) | [main]
open fun [getTarget](get-target.md)(): [Texture.Sampler](-sampler/index.md) |
| [getWidth](get-width.md) | [main]
open fun [getWidth](get-width.md)(level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html)
Queries the width of a given level of this texture. |
| [isTextureFormatMipmappable](is-texture-format-mipmappable.md) | [main]
open fun [isTextureFormatMipmappable](is-texture-format-mipmappable.md)(engine: [Engine](../-engine/index.md), format: [Texture.InternalFormat](-internal-format/index.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Checks whether a given texture format is supported for mipmapping in this [Engine](../-engine/index.md). |
| [isTextureFormatSupported](is-texture-format-supported.md) | [main]
open fun [isTextureFormatSupported](is-texture-format-supported.md)(engine: [Engine](../-engine/index.md), format: [Texture.InternalFormat](-internal-format/index.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Checks whether a given format is supported for texturing in this [Engine](../-engine/index.md). |
| [isTextureSwizzleSupported](is-texture-swizzle-supported.md) | [main]
open fun [isTextureSwizzleSupported](is-texture-swizzle-supported.md)(engine: [Engine](../-engine/index.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Checks whether texture swizzling is supported in this [Engine](../-engine/index.md). |
| [setExternalImage](set-external-image.md) | [main]
open fun [setExternalImage](set-external-image.md)(engine: [Engine](../-engine/index.md), externalImageRef: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-any/index.html))
open fun [setExternalImage](set-external-image.md)(engine: [Engine](../-engine/index.md), eglImage: [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-long/index.html))
Specifies the external image to associate with this `Texture`. |
| [setExternalStream](set-external-stream.md) | [main]
open fun [setExternalStream](set-external-stream.md)(engine: [Engine](../-engine/index.md), stream: [Stream](../-stream/index.md))
Specifies the external stream to associate with this `Texture`. |
| [setImage](set-image.md) | [main]
open fun [setImage](set-image.md)(engine: [Engine](../-engine/index.md), level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), buffer: [Texture.PixelBufferDescriptor](-pixel-buffer-descriptor/index.md))
`setImage` is used to modify the whole content of the texture from a CPU-buffer.
[main]
open fun [setImage](set-image.md)(engine: [Engine](../-engine/index.md), level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), xoffset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), yoffset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), width: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), height: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), buffer: [Texture.PixelBufferDescriptor](-pixel-buffer-descriptor/index.md))
`setImage` is used to modify a sub-region of the texture from a CPU-buffer.
[main]
open fun [setImage](set-image.md)(engine: [Engine](../-engine/index.md), level: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), xoffset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), yoffset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), zoffset: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), width: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), height: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), depth: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-int/index.html), buffer: [Texture.PixelBufferDescriptor](-pixel-buffer-descriptor/index.md))
`setImage` is used to modify a sub-region of a 3D texture, 2D texture array or cubemap from a CPU-buffer. |
| [validatePixelFormatAndType](validate-pixel-format-and-type.md) | [main]
open fun [validatePixelFormatAndType](validate-pixel-format-and-type.md)(internalFormat: [Texture.InternalFormat](-internal-format/index.md), pixelDataFormat: [Texture.Format](-format/index.md), pixelDataType: [Texture.Type](-type/index.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin-stdlib/kotlin/-boolean/index.html)
Checks whether a given combination of texture format, pixel data and type is valid. |