Back to Filament

setImage

docs/android/dokka/filament-android/com.google.android.filament/-texture/set-image.md

1.75.06.1 KB
Original Source

//filament-android/com.google.android.filament/Texture/setImage

setImage

[main]
open fun setImage(engine: Engine, level: Int, buffer: Texture.PixelBufferDescriptor)

setImage is used to modify the whole content of the texture from a CPU-buffer.

This Texture instance must use SAMPLER_2D or SAMPLER_EXTERNAL. If the later is specified and external textures are supported by the driver implementation, this method will have no effect, otherwise it will behave as if the texture was specified with SAMPLER_2D.

This is equivalent to calling: setImage(engine, level, 0, 0, getWidth(level), getHeight(level), buffer)

Parameters

main

engineEngine this texture is associated to. Must be the instance passed to Builder.build().
levelLevel to set the image for. Must be less than getLevels.
bufferClient-side buffer containing the image to set. buffer's format must match that of getFormat

See also

Texture.Builder
Texture.PixelBufferDescriptor

Throws

BufferOverflowExceptionif the specified parameters would result in reading outside of buffer.

[main]
open fun setImage(engine: Engine, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, buffer: Texture.PixelBufferDescriptor)

setImage is used to modify a sub-region of the texture from a CPU-buffer.

This Texture instance must use SAMPLER_2D or SAMPLER_EXTERNAL. If the later is specified and external textures are supported by the driver implementation, this method will have no effect, otherwise it will behave as if the texture was specified with SAMPLER_2D.

Parameters

main

engineEngine this texture is associated to. Must be the instance passed to Builder.build().
levelLevel to set the image for. Must be less than getLevels.
xoffsetx-offset in texel of the region to modify
yoffsety-offset in texel of the region to modify
widthwidth in texel of the region to modify
heightheight in texel of the region to modify
bufferClient-side buffer containing the image to set. buffer's format must match that of getFormat

See also

Texture.Builder
Texture.PixelBufferDescriptor

Throws

BufferOverflowExceptionif the specified parameters would result in reading outside of buffer.

[main]
open fun setImage(engine: Engine, level: Int, xoffset: Int, yoffset: Int, zoffset: Int, width: Int, height: Int, depth: Int, buffer: Texture.PixelBufferDescriptor)

setImage is used to modify a sub-region of a 3D texture, 2D texture array or cubemap from a CPU-buffer. Cubemaps are treated like a 2D array of six layers.

This Texture instance must use SAMPLER_2D_ARRAY, SAMPLER_3D or SAMPLER_CUBEMAP.

Parameters

main

engineEngine this texture is associated to. Must be the instance passed to Builder.build().
levelLevel to set the image for. Must be less than getLevels.
xoffsetx-offset in texel of the region to modify
yoffsety-offset in texel of the region to modify
zoffsetz-offset in texel of the region to modify
widthwidth in texel of the region to modify
heightheight in texel of the region to modify
depthdepth in texel or index of the region to modify
bufferClient-side buffer containing the image to set. buffer's format must match that of getFormat

See also

Texture.Builder
Texture.PixelBufferDescriptor

Throws

BufferOverflowExceptionif the specified parameters would result in reading outside of buffer.