template<UnsignedInt dimensions>
Magnum::GL::TextureArray class

Texture array.

Template class for one- and two-dimensional texture arrays. See also AbstractTexture documentation for more information.

Usage

See Texture documentation for introduction.

Common usage is to fully configure all texture parameters and then set the data. Example configuration:

GL::Texture2DArray texture;
texture.setMagnificationFilter(GL::SamplerFilter::Linear)
    .setMinificationFilter(GL::SamplerFilter::Linear, GL::SamplerMipmap::Linear)
    .setWrapping(GL::SamplerWrapping::ClampToEdge)
    .setMaxAnisotropy(GL::Sampler::maxMaxAnisotropy());;

It is often more convenient to first allocate the memory for all layers by calling setStorage() and then specify each layer separately using setSubImage():

texture.setStorage(levels, GL::TextureFormat::RGBA8, {64, 64, 16});

for(std::size_t i = 0; i != 16; ++i) {
    ImageView3D image(PixelFormat::RGBA8Unorm, {64, 64, 1}, data);
    texture.setSubImage(0, Vector3i::zAxis(i), image);
}

In shader, the texture is used via sampler1DArray / sampler2DArray, sampler1DArrayShadow / sampler1DArrayShadow, isampler1DArray / isampler2DArray or usampler1DArray / usampler2DArray. See AbstractShaderProgram documentation for more information about usage in shaders.

Base classes

class AbstractTexture
Base for textures.

Public types

enum (anonymous): UnsignedInt { Dimensions = dimensions }

Public static functions

static auto maxSize() -> VectorTypeFor<dimensions+1, Int>
Max supported texture array size.
static auto compressedBlockSize(TextureFormat format) -> VectorTypeFor<dimensions, Int>
Compressed block size.
static auto compressedBlockDataSize(TextureFormat format) -> Int
Compressed block data size.
static auto view(TextureArray<dimensions>& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) -> TextureArray<dimensions> new in Git master
Create a view on another texture array.
static auto view(Texture<dimensions>& original, TextureFormat internalFormat, Int levelOffset, Int levelCount) -> TextureArray<dimensions> new in Git master
Create a view on a texture.
static auto view(CubeMapTexture& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) -> TextureArray<dimensions> new in Git master
Create a view on a cube map texture.
static auto view(CubeMapTextureArray& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) -> TextureArray<dimensions> new in Git master
Create a view on a cube map texture array.
static auto wrap(GLuint id, ObjectFlags flags = {}) -> TextureArray<dimensions>
Wrap existing OpenGL texture array object.

Constructors, destructors, conversion operators

TextureArray() explicit
Constructor.
TextureArray(NoCreateT) explicit noexcept
Construct without creating the underlying OpenGL object.
TextureArray(const TextureArray<dimensions>&) deleted
Copying is not allowed.
TextureArray(TextureArray<dimensions>&&) defaulted noexcept
Move constructor.

Public functions

auto operator=(const TextureArray<dimensions>&) -> TextureArray<dimensions>& deleted
Copying is not allowed.
auto operator=(TextureArray<dimensions>&&) -> TextureArray<dimensions>& defaulted noexcept
Move assignment.
void bindImage(Int imageUnit, Int level, Int layer, ImageAccess access, ImageFormat format)
Bind level of given texture layer to given image unit.
void bindImageLayered(Int imageUnit, Int level, ImageAccess access, ImageFormat format)
Bind level of layered texture to given image unit.
auto setBaseLevel(Int level) -> TextureArray<dimensions>&
Set base mip level.
auto setMaxLevel(Int level) -> TextureArray<dimensions>&
Set max mip level.
auto setMinificationFilter(SamplerFilter filter, SamplerMipmap mipmap = SamplerMipmap::Base) -> TextureArray<dimensions>&
Set minification filter.
auto setMinificationFilter(Magnum::SamplerFilter filter, Magnum::SamplerMipmap mipmap = Magnum::SamplerMipmap::Base) -> TextureArray<dimensions>&
auto setMagnificationFilter(SamplerFilter filter) -> TextureArray<dimensions>&
Set magnification filter.
auto setMagnificationFilter(Magnum::SamplerFilter filter) -> TextureArray<dimensions>&
auto setMinLod(Float lod) -> TextureArray<dimensions>&
Set the minimum level-of-detail.
auto setMaxLod(Float lod) -> TextureArray<dimensions>&
Set the maximum level-of-detail.
auto setLodBias(Float bias) -> TextureArray<dimensions>&
Set level-of-detail bias.
auto setWrapping(const Math::Vector<dimensions, SamplerWrapping>& wrapping) -> TextureArray<dimensions>&
Set wrapping.
auto setWrapping(const Math::Vector<dimensions, Magnum::SamplerWrapping>& wrapping) -> TextureArray<dimensions>&
auto setWrapping(SamplerWrapping wrapping) -> TextureArray<dimensions>&
Set the same wrapping for all dimensions.
auto setWrapping(Magnum::SamplerWrapping wrapping) -> TextureArray<dimensions>&
auto setBorderColor(const Color4& color) -> TextureArray<dimensions>&
Set border color.
auto setBorderColor(const Vector4ui& color) -> TextureArray<dimensions>&
Set border color for integer texture.
auto setBorderColor(const Vector4i& color) -> TextureArray<dimensions>&
auto setMaxAnisotropy(Float anisotropy) -> TextureArray<dimensions>&
Set max anisotropy.
auto setSrgbDecode(bool decode) -> TextureArray<dimensions>&
Set sRGB decoding.
template<char r, char g, char b, char a>
auto setSwizzle() -> TextureArray<dimensions>&
Set component swizzle.
auto setCompareMode(SamplerCompareMode mode) -> TextureArray<dimensions>&
Set depth texture comparison mode.
auto setCompareFunction(SamplerCompareFunction function) -> TextureArray<dimensions>&
Set depth texture comparison function.
auto setDepthStencilMode(SamplerDepthStencilMode mode) -> TextureArray<dimensions>&
Set depth/stencil texture mode.
auto setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor<dimensions+1, Int>& size) -> TextureArray<dimensions>&
Set storage.
auto imageSize(Int level) -> VectorTypeFor<dimensions+1, Int>
Image size in given mip level.
void image(Int level, Image<dimensions+1>& image)
Read given texture mip level to an image.
auto image(Int level, Image<dimensions+1>&& image) -> Image<dimensions+1>
void image(Int level, const BasicMutableImageView<dimensions+1>& image) new in 2019.10
Read given texture mip level to an image view.
void image(Int level, BufferImage<dimensions+1>& image, BufferUsage usage)
Read given texture mip level to a buffer image.
auto image(Int level, BufferImage<dimensions+1>&& image, BufferUsage usage) -> BufferImage<dimensions+1>
void compressedImage(Int level, CompressedImage<dimensions+1>& image)
Read given compressed texture mip level to an image.
auto compressedImage(Int level, CompressedImage<dimensions+1>&& image) -> CompressedImage<dimensions+1>
void compressedImage(Int level, const BasicMutableCompressedImageView<dimensions+1>& image) new in 2019.10
Read given compressed texture mip level to an image view.
void compressedImage(Int level, CompressedBufferImage<dimensions+1>& image, BufferUsage usage)
Read given compressed texture mip level to a buffer image.
auto compressedImage(Int level, CompressedBufferImage<dimensions+1>&& image, BufferUsage usage) -> CompressedBufferImage<dimensions+1>
void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>& image)
Read a range of given texture mip level to an image.
auto subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>&& image) -> Image<dimensions+1>
void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, const BasicMutableImageView<dimensions+1>& image) new in 2019.10
Read a range of given texture mip level to an image view.
void subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>& image, BufferUsage usage)
Read a range of given texture mip level to a buffer image.
auto subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>&& image, BufferUsage usage) -> BufferImage<dimensions+1>
void compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>& image)
Read a range of given compressed texture mip level to an image.
auto compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>&& image) -> CompressedImage<dimensions+1>
void compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, const BasicMutableCompressedImageView<dimensions+1>& image) new in 2019.10
Read a range of given compressed texture mip level to an image view.
void compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>& image, BufferUsage usage)
Read a range of given compressed texture mip level to a buffer image.
auto compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>&& image, BufferUsage usage) -> CompressedBufferImage<dimensions+1>
auto setImage(Int level, TextureFormat internalFormat, const BasicImageView<dimensions+1>& image) -> TextureArray<dimensions>&
Set image data.
auto setImage(Int level, TextureFormat internalFormat, BufferImage<dimensions+1>& image) -> TextureArray<dimensions>&
auto setImage(Int level, TextureFormat internalFormat, BufferImage<dimensions+1>&& image) -> TextureArray<dimensions>&
auto setCompressedImage(Int level, const BasicCompressedImageView<dimensions+1>& image) -> TextureArray<dimensions>&
Set compressed image data.
auto setCompressedImage(Int level, CompressedBufferImage<dimensions+1>& image) -> TextureArray<dimensions>&
auto setCompressedImage(Int level, CompressedBufferImage<dimensions+1>&& image) -> TextureArray<dimensions>&
auto setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const BasicImageView<dimensions+1>& image) -> TextureArray<dimensions>&
Set image subdata.
auto setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>& image) -> TextureArray<dimensions>&
auto setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>&& image) -> TextureArray<dimensions>&
auto setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const BasicCompressedImageView<dimensions+1>& image) -> TextureArray<dimensions>&
Set compressed image subdata.
auto setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, CompressedBufferImage<dimensions+1>& image) -> TextureArray<dimensions>&
auto setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, CompressedBufferImage<dimensions+1>&& image) -> TextureArray<dimensions>&
auto generateMipmap() -> TextureArray<dimensions>&
Generate mipmap.
void invalidateImage(Int level)
Invalidate texture image.
void invalidateSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const VectorTypeFor<dimensions+1, Int>& size)
Invalidate texture subimage.

Enum documentation

template<UnsignedInt dimensions>
enum Magnum::GL::TextureArray<dimensions>::(anonymous): UnsignedInt

Enumerators
Dimensions

Texture dimension count

Function documentation

template<UnsignedInt dimensions>
static VectorTypeFor<dimensions+1, Int> Magnum::GL::TextureArray<dimensions>::maxSize()

Max supported texture array size.

The result is cached, repeated queries don't result in repeated OpenGL calls. If extension EXT_texture_array (part of OpenGL 3.0) is not available, returns zero vector.

template<UnsignedInt dimensions>
static VectorTypeFor<dimensions, Int> Magnum::GL::TextureArray<dimensions>::compressedBlockSize(TextureFormat format)

Compressed block size.

See Texture::compressedBlockSize() for more information.

template<UnsignedInt dimensions>
static Int Magnum::GL::TextureArray<dimensions>::compressedBlockDataSize(TextureFormat format)

Compressed block data size.

See Texture::compressedBlockDataSize() for more information.

template<UnsignedInt dimensions>
static TextureArray<dimensions> Magnum::GL::TextureArray<dimensions>::view(TextureArray<dimensions>& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) new in Git master

Create a view on another texture array.

The internalFormat has to either match the format of original, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.

template<UnsignedInt dimensions>
static TextureArray<dimensions> Magnum::GL::TextureArray<dimensions>::view(Texture<dimensions>& original, TextureFormat internalFormat, Int levelOffset, Int levelCount) new in Git master

Create a view on a texture.

The internalFormat has to either match the format of original, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.

template<UnsignedInt dimensions>
static TextureArray<dimensions> Magnum::GL::TextureArray<dimensions>::view(CubeMapTexture& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) new in Git master

Create a view on a cube map texture.

Enabled only on a Texture2DArray. The internalFormat has to either match the format of original, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.

template<UnsignedInt dimensions>
static TextureArray<dimensions> Magnum::GL::TextureArray<dimensions>::view(CubeMapTextureArray& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset, Int layerCount) new in Git master

Create a view on a cube map texture array.

Enabled only on a Texture2DArray. The internalFormat has to either match the format of original, or be compatible with it, such as having the same pixel size and other restrictions described in the OpenGL specification.

template<UnsignedInt dimensions>
static TextureArray<dimensions> Magnum::GL::TextureArray<dimensions>::wrap(GLuint id, ObjectFlags flags = {})

Wrap existing OpenGL texture array object.

Parameters
id OpenGL texture array ID
flags Object creation flags

The id is expected to be of an existing OpenGL texture object with target GL_TEXTURE_1D_ARRAY or GL_TEXTURE_2D_ARRAY based on dimension count. Unlike texture created using constructor, the OpenGL object is by default not deleted on destruction, use flags for different behavior.

template<UnsignedInt dimensions>
Magnum::GL::TextureArray<dimensions>::TextureArray() explicit

Constructor.

Creates new OpenGL texture object. If ARB_direct_state_access (part of OpenGL 4.5) is not available, the texture is created on first use.

template<UnsignedInt dimensions>
Magnum::GL::TextureArray<dimensions>::TextureArray(NoCreateT) explicit noexcept

Construct without creating the underlying OpenGL object.

The constructed instance is equivalent to moved-from state. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.

This function can be safely used for constructing (and later destructing) objects even without any OpenGL context being active. However note that this is a low-level and a potentially dangerous API, see the documentation of NoCreate for alternatives.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::bindImage(Int imageUnit, Int level, Int layer, ImageAccess access, ImageFormat format)

Bind level of given texture layer to given image unit.

Parameters
imageUnit Image unit
level Texture level
layer Texture layer
access Image access
format Image format

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::bindImageLayered(Int imageUnit, Int level, ImageAccess access, ImageFormat format)

Bind level of layered texture to given image unit.

Parameters
imageUnit Image unit
level Texture level
access Image access
format Image format

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setBaseLevel(Int level)

Set base mip level.

Returns Reference to self (for method chaining)

See Texture::setBaseLevel() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMaxLevel(Int level)

Set max mip level.

Returns Reference to self (for method chaining)

See Texture::setMaxLevel() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMinificationFilter(SamplerFilter filter, SamplerMipmap mipmap = SamplerMipmap::Base)

Set minification filter.

Returns Reference to self (for method chaining)

See Texture::setMinificationFilter() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMinificationFilter(Magnum::SamplerFilter filter, Magnum::SamplerMipmap mipmap = Magnum::SamplerMipmap::Base)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMagnificationFilter(SamplerFilter filter)

Set magnification filter.

Returns Reference to self (for method chaining)

See Texture::setMagnificationFilter() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMagnificationFilter(Magnum::SamplerFilter filter)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMinLod(Float lod)

Set the minimum level-of-detail.

Returns Reference to self (for method chaining)

See Texture::setMinLod() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMaxLod(Float lod)

Set the maximum level-of-detail.

Returns Reference to self (for method chaining)

See Texture::setMaxLod() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setLodBias(Float bias)

Set level-of-detail bias.

Returns Reference to self (for method chaining)

See Texture::setLodBias() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setWrapping(const Math::Vector<dimensions, SamplerWrapping>& wrapping)

Set wrapping.

Returns Reference to self (for method chaining)

See Texture::setWrapping() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setWrapping(const Math::Vector<dimensions, Magnum::SamplerWrapping>& wrapping)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setWrapping(SamplerWrapping wrapping)

Set the same wrapping for all dimensions.

Returns Reference to self (for method chaining)

Same as calling setWrapping(const Math::Vector<dimensions, SamplerWrapping>&) with the same value for all dimensions.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setWrapping(Magnum::SamplerWrapping wrapping)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setBorderColor(const Color4& color)

Set border color.

Returns Reference to self (for method chaining)

See Texture::setBorderColor(const Color4&) for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setBorderColor(const Vector4ui& color)

Set border color for integer texture.

Returns Reference to self (for method chaining)

See Texture::setBorderColor(const Vector4ui&) for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setBorderColor(const Vector4i& color)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setMaxAnisotropy(Float anisotropy)

Set max anisotropy.

Returns Reference to self (for method chaining)

See Texture::setMaxAnisotropy() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setSrgbDecode(bool decode)

Set sRGB decoding.

Returns Reference to self (for method chaining)

See Texture::setSrgbDecode() for more information.

template<UnsignedInt dimensions> template<char r, char g, char b, char a>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setSwizzle()

Set component swizzle.

Returns Reference to self (for method chaining)

See Texture::setSwizzle() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompareMode(SamplerCompareMode mode)

Set depth texture comparison mode.

Returns Reference to self (for method chaining)

See Texture::setCompareMode() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompareFunction(SamplerCompareFunction function)

Set depth texture comparison function.

Returns Reference to self (for method chaining)

See Texture::setCompareFunction() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setDepthStencilMode(SamplerDepthStencilMode mode)

Set depth/stencil texture mode.

Returns Reference to self (for method chaining)

See Texture::setDepthStencilMode() for more information.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setStorage(Int levels, TextureFormat internalFormat, const VectorTypeFor<dimensions+1, Int>& size)

Set storage.

Returns Reference to self (for method chaining)

See Texture::setStorage() for more information.

template<UnsignedInt dimensions>
VectorTypeFor<dimensions+1, Int> Magnum::GL::TextureArray<dimensions>::imageSize(Int level)

Image size in given mip level.

See Texture::imageSize() for more information.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::image(Int level, Image<dimensions+1>& image)

Read given texture mip level to an image.

Behavior mostly equivalent to Texture::image(Int, Image&), see its documentation for more information. In this case however, ImageFlags of image get set to ImageFlag*D::Array.

template<UnsignedInt dimensions>
Image<dimensions+1> Magnum::GL::TextureArray<dimensions>::image(Int level, Image<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

Image3D image = texture.image(0, {PixelFormat::RGBA8Unorm});

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::image(Int level, const BasicMutableImageView<dimensions+1>& image) new in 2019.10

Read given texture mip level to an image view.

Compared to image(Int, Image<dimensions+1>&) the function reads the pixels into the memory provided by image, expecting it's not nullptr and its size is the same as size of given level. Any set of ImageFlags is allowed in image — e.g., it's possible to read an array texture to an image not marked as an array.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::image(Int level, BufferImage<dimensions+1>& image, BufferUsage usage)

Read given texture mip level to a buffer image.

See Texture::image(Int, BufferImage&, BufferUsage) for more information.

template<UnsignedInt dimensions>
BufferImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::image(Int level, BufferImage<dimensions+1>&& image, BufferUsage usage)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

GL::BufferImage3D image = texture.image(0,
    {PixelFormat::RGBA8Unorm}, GL::BufferUsage::StaticRead);

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedImage(Int level, CompressedImage<dimensions+1>& image)

Read given compressed texture mip level to an image.

Behavior mostly equivalent to Texture::compressedImage(Int, CompressedImage&), see its documentation for more information. In this case however, ImageFlags of image get set to ImageFlag*D::Array.

template<UnsignedInt dimensions>
CompressedImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::compressedImage(Int level, CompressedImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

CompressedImage3D image = texture.compressedImage(0, {});

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedImage(Int level, const BasicMutableCompressedImageView<dimensions+1>& image) new in 2019.10

Read given compressed texture mip level to an image view.

Compared to compressedImage(Int, CompressedImage<dimensions+1>&) the function reads the pixels into the memory provided by image, expecting it's not nullptr, its format is the same as texture format and its size is the same as size of given level. Any set of ImageFlags is allowed in image — e.g., it's possible to read an array texture to an image not marked as an array.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedImage(Int level, CompressedBufferImage<dimensions+1>& image, BufferUsage usage)

Read given compressed texture mip level to a buffer image.

See Texture::compressedImage(Int, CompressedBufferImage&, BufferUsage) for more information.

template<UnsignedInt dimensions>
CompressedBufferImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::compressedImage(Int level, CompressedBufferImage<dimensions+1>&& image, BufferUsage usage)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

GL::CompressedBufferImage3D image = texture.compressedImage(0, {},
    GL::BufferUsage::StaticRead);

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>& image)

Read a range of given texture mip level to an image.

Behavior mostly equivalent to Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&), see its documentation for more information. In this case however, ImageFlags of image get set to ImageFlag*D::Array.

template<UnsignedInt dimensions>
Image<dimensions+1> Magnum::GL::TextureArray<dimensions>::subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

Image3D image = texture.subImage(0, range, {PixelFormat::RGBA8Unorm});

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, const BasicMutableImageView<dimensions+1>& image) new in 2019.10

Read a range of given texture mip level to an image view.

Compared to subImage(Int, const RangeTypeFor<dimensions+1, Int>&, Image<dimensions+1>&) the function reads the pixels into the memory provided by image, expecting it's not nullptr and its size is the same as range size. Any set of ImageFlags is allowed in image — e.g., it's possible to read an array texture to an image not marked as an array.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>& image, BufferUsage usage)

Read a range of given texture mip level to a buffer image.

See Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage) for more information.

template<UnsignedInt dimensions>
BufferImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::subImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>&& image, BufferUsage usage)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

GL::BufferImage3D image = texture.subImage(0, range,
    {PixelFormat::RGBA8Unorm}, GL::BufferUsage::StaticRead);

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>& image)

Read a range of given compressed texture mip level to an image.

Behavior mostly equivalent to Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedImage&), see its documentation for more information. In this case however, ImageFlags of image get set to ImageFlag*D::Array.

template<UnsignedInt dimensions>
CompressedImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

CompressedImage3D image = texture.compressedSubImage(0, range, {});

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, const BasicMutableCompressedImageView<dimensions+1>& image) new in 2019.10

Read a range of given compressed texture mip level to an image view.

Compared to compressedSubImage(Int, const RangeTypeFor<dimensions+1, Int>&, CompressedImage<dimensions+1>&) the function reads the pixels into the memory provided by image, expecting it's not nullptr, its format is the same as texture format and its size is the same as range size. Any set of ImageFlags is allowed in image — e.g., it's possible to read an array texture to an image not marked as an array.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>& image, BufferUsage usage)

Read a range of given compressed texture mip level to a buffer image.

See Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedBufferImage&, BufferUsage) for more information.

template<UnsignedInt dimensions>
CompressedBufferImage<dimensions+1> Magnum::GL::TextureArray<dimensions>::compressedSubImage(Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>&& image, BufferUsage usage)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Convenience alternative to the above, example usage:

GL::CompressedBufferImage3D image = texture.compressedSubImage(0, range, {},
    GL::BufferUsage::StaticRead);

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setImage(Int level, TextureFormat internalFormat, const BasicImageView<dimensions+1>& image)

Set image data.

Returns Reference to self (for method chaining)

Behavior equivalent to Texture::setImage(), see its documentation for more information. Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image not marked as an array to an array texture.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setImage(Int level, TextureFormat internalFormat, BufferImage<dimensions+1>& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setImage(Int level, TextureFormat internalFormat, BufferImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedImage(Int level, const BasicCompressedImageView<dimensions+1>& image)

Set compressed image data.

Returns Reference to self (for method chaining)

Behavior equivalent to Texture::setCompressedImage(), see its documentation for more information. Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image not marked as an array to an array texture.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedImage(Int level, CompressedBufferImage<dimensions+1>& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedImage(Int level, CompressedBufferImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const BasicImageView<dimensions+1>& image)

Set image subdata.

Parameters
level Mip level
offset Offset where to put data in the texture
image Image, ImageView or Trade::ImageData of the same dimension count
Returns Reference to self (for method chaining)

If ARB_direct_state_access (part of OpenGL 4.5) is not available, the texture is bound before the operation (if not already).

Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image not marked as an array to an array texture.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, BufferImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const BasicCompressedImageView<dimensions+1>& image)

Set compressed image subdata.

Parameters
level Mip level
offset Offset where to put data in the texture
image CompressedImage, CompressedImageView or compressed Trade::ImageData of the same dimension count
Returns Reference to self (for method chaining)

If ARB_direct_state_access (part of OpenGL 4.5) is not available, the texture is bound before the operation (if not already).

Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image not marked as an array to an array texture.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, CompressedBufferImage<dimensions+1>& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::setCompressedSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, CompressedBufferImage<dimensions+1>&& image)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions>
TextureArray<dimensions>& Magnum::GL::TextureArray<dimensions>::generateMipmap()

Generate mipmap.

Returns Reference to self (for method chaining)

See Texture::generateMipmap() for more information.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::invalidateImage(Int level)

Invalidate texture image.

See Texture::invalidateImage() for more information.

template<UnsignedInt dimensions>
void Magnum::GL::TextureArray<dimensions>::invalidateSubImage(Int level, const VectorTypeFor<dimensions+1, Int>& offset, const VectorTypeFor<dimensions+1, Int>& size)

Invalidate texture subimage.

See Texture::invalidateSubImage() for more information.