class
CubeMapTextureArrayCube map texture array.
Contents
See CubeMapTexture documentation for introduction.
Usage
See Texture documentation for introduction.
Common usage is to specify each layer and face separately using setSubImage(). You have to allocate the memory for all layers and faces first by calling setStorage(). Example: array with 4 layers of cube maps, each cube map consisting of six 64x64 images, i.e. 24 layers total:
GL::CubeMapTextureArray texture; texture.setMagnificationFilter(GL::SamplerFilter::Linear) // ... .setStorage(Math::log2(64)+1, GL::TextureFormat::RGBA8, {64, 64, 24}); for(std::size_t i = 0; i != 4; i += 6) { ImageView3D imagePositiveX(PixelFormat::RGBA8Unorm, {64, 64, 1}, data); // ... texture.setSubImage(0, Vector3i::zAxis(i+0), imagePositiveX); texture.setSubImage(0, Vector3i::zAxis(i+1), imageNegativeX); texture.setSubImage(0, Vector3i::zAxis(i+2), imagePositiveY); // ... } texture.generateMipmap();
In shader, the texture is used via samplerCubeArray
, samplerCubeArrayShadow
, isamplerCubeArray
or usamplerCubeArray
. Unlike in classic textures, coordinates for cube map texture arrays is signed four-part vector. First three parts define vector from the center of the cube which intersects with one of the six sides of the cube map, fourth part is layer in the array. See AbstractShaderProgram for more information about usage in shaders.
Base classes
- class AbstractTexture
- Base for textures.
Public static functions
- static auto maxSize() -> Vector3i
- Max supported size of one side of cube map texture array.
- static auto compressedBlockSize(TextureFormat format) -> Vector2i
- Compressed block size.
- static auto compressedBlockDataSize(TextureFormat format) -> Int
- Compressed block data size.
- static auto wrap(GLuint id, ObjectFlags flags = {}) -> CubeMapTextureArray
- Wrap existing OpenGL cube map array texture object.
Constructors, destructors, conversion operators
- CubeMapTextureArray() explicit
- Constructor.
- CubeMapTextureArray(NoCreateT) explicit noexcept
- Construct without creating the underlying OpenGL object.
Public functions
- 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) -> CubeMapTextureArray&
- Set base mip level.
- auto setMaxLevel(Int level) -> CubeMapTextureArray&
- Set max mip level.
-
auto setMinificationFilter(SamplerFilter filter,
SamplerMipmap mipmap = SamplerMipmap::
Base) -> CubeMapTextureArray& - Set minification filter.
-
auto setMinificationFilter(Magnum::
SamplerFilter filter, Magnum:: SamplerMipmap mipmap = Magnum:: SamplerMipmap:: Base) -> CubeMapTextureArray& - auto setMagnificationFilter(SamplerFilter filter) -> CubeMapTextureArray&
- Set magnification filter.
-
auto setMagnificationFilter(Magnum::
SamplerFilter filter) -> CubeMapTextureArray& - auto setMinLod(Float lod) -> CubeMapTextureArray&
- Set minimum level-of-detail parameter.
- auto setMaxLod(Float lod) -> CubeMapTextureArray&
- Set maximum level-of-detail parameter.
- auto setLodBias(Float bias) -> CubeMapTextureArray&
- Set level-of-detail bias.
- auto setWrapping(const Array2D<SamplerWrapping>& wrapping) -> CubeMapTextureArray&
- Set wrapping.
-
auto setWrapping(const Array2D<Magnum::
SamplerWrapping>& wrapping) -> CubeMapTextureArray& - auto setBorderColor(const Color4& color) -> CubeMapTextureArray&
- Set border color.
- auto setBorderColor(const Vector4ui& color) -> CubeMapTextureArray&
- Set border color for integer texture.
- auto setBorderColor(const Vector4i& color) -> CubeMapTextureArray&
- auto setMaxAnisotropy(Float anisotropy) -> CubeMapTextureArray&
- Set max anisotropy.
- auto setSRGBDecode(bool decode) -> CubeMapTextureArray&
- Set sRGB decoding.
-
template<char r, char g, char b, char a>auto setSwizzle() -> CubeMapTextureArray&
- Set component swizzle.
- auto setCompareMode(SamplerCompareMode mode) -> CubeMapTextureArray&
- Set depth texture comparison mode.
- auto setCompareFunction(SamplerCompareFunction function) -> CubeMapTextureArray&
- Set depth texture comparison function.
- auto setDepthStencilMode(SamplerDepthStencilMode mode) -> CubeMapTextureArray&
- Set depth/stencil texture mode.
- auto setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) -> CubeMapTextureArray&
- Set storage.
- auto imageSize(Int level) -> Vector3i
- Image size in given mip level.
- void image(Int level, Image3D& image)
- Read given mip level of texture to image.
- auto image(Int level, Image3D&& image) -> Image3D
- void image(Int level, BufferImage3D& image, BufferUsage usage)
- Read given mip level of texture to buffer image.
- auto image(Int level, BufferImage3D&& image, BufferUsage usage) -> BufferImage3D
- void compressedImage(Int level, CompressedImage3D& image)
- Read given mip level of compressed texture to image.
- auto compressedImage(Int level, CompressedImage3D&& image) -> CompressedImage3D
- void compressedImage(Int level, CompressedBufferImage3D& image, BufferUsage usage)
- Read given mip level of compressed texture to buffer image.
- auto compressedImage(Int level, CompressedBufferImage3D&& image, BufferUsage usage) -> CompressedBufferImage3D
- void subImage(Int level, const Range3Di& range, Image3D& image)
- Read range of given texture mip level to image.
- auto subImage(Int level, const Range3Di& range, Image3D&& image) -> Image3D
- void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage)
- Read range of given texture mip level to buffer image.
- auto subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage) -> BufferImage3D
- void compressedSubImage(Int level, const Range3Di& range, CompressedImage3D& image)
- Read range of given compressed texture mip level to image.
- auto compressedSubImage(Int level, const Range3Di& range, CompressedImage3D&& image) -> CompressedImage3D
- void compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D& image, BufferUsage usage)
- Read range of given compressed texture mip level to buffer image.
- auto compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D&& image, BufferUsage usage) -> CompressedBufferImage3D
- auto setImage(Int level, TextureFormat internalFormat, const ImageView3D& image) -> CubeMapTextureArray&
- Set image data.
- auto setImage(Int level, TextureFormat internalFormat, BufferImage3D& image) -> CubeMapTextureArray&
- auto setImage(Int level, TextureFormat internalFormat, BufferImage3D&& image) -> CubeMapTextureArray&
- auto setCompressedImage(Int level, const CompressedImageView3D& image) -> CubeMapTextureArray&
- Set compressed image data.
- auto setCompressedImage(Int level, CompressedBufferImage3D& image) -> CubeMapTextureArray&
- auto setCompressedImage(Int level, CompressedBufferImage3D&& image) -> CubeMapTextureArray&
- auto setSubImage(Int level, const Vector3i& offset, const ImageView3D& image) -> CubeMapTextureArray&
- Set image subdata.
- auto setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) -> CubeMapTextureArray&
- auto setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) -> CubeMapTextureArray&
- auto setCompressedSubImage(Int level, const Vector3i& offset, const CompressedImageView3D& image) -> CubeMapTextureArray&
- Set compressed image subdata.
- auto setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D& image) -> CubeMapTextureArray&
- auto setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D&& image) -> CubeMapTextureArray&
- auto generateMipmap() -> CubeMapTextureArray&
- Generate mipmap.
- void invalidateImage(Int level)
- Invalidate texture image.
- void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size)
- Invalidate texture subimage.
Function documentation
static Vector3i Magnum:: GL:: CubeMapTextureArray:: maxSize()
Max supported size of one side of cube map texture array.
The result is cached, repeated queries don't result in repeated OpenGL calls. If ARB_
static Vector2i Magnum:: GL:: CubeMapTextureArray:: compressedBlockSize(TextureFormat format)
Compressed block size.
See Texture::
static Int Magnum:: GL:: CubeMapTextureArray:: compressedBlockDataSize(TextureFormat format)
Compressed block data size.
See Texture::
static CubeMapTextureArray Magnum:: GL:: CubeMapTextureArray:: wrap(GLuint id,
ObjectFlags flags = {})
Wrap existing OpenGL cube map array texture object.
Parameters | |
---|---|
id | OpenGL cube map array texture ID |
flags | Object creation flags |
The id
is expected to be of an existing OpenGL texture object with target GL_TEXTURE_CUBE_MAP_ARRAY
. Unlike texture created using constructor, the OpenGL object is by default not deleted on destruction, use flags
for different behavior.
Magnum:: GL:: CubeMapTextureArray:: CubeMapTextureArray() explicit
Constructor.
Creates new OpenGL texture object. If ARB_
Magnum:: GL:: CubeMapTextureArray:: CubeMapTextureArray(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.
void Magnum:: GL:: CubeMapTextureArray:: 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 |
Layer is equivalent to layer * 6 + number of texture face, i.e. +X is 0
and so on, in order of (+X, -X, +Y, -Y, +Z, -Z).
void Magnum:: GL:: CubeMapTextureArray:: 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 |
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setBaseLevel(Int level)
Set base mip level.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMaxLevel(Int level)
Set max mip level.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMinificationFilter(SamplerFilter filter,
SamplerMipmap mipmap = SamplerMipmap:: Base)
Set minification filter.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: 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.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMagnificationFilter(SamplerFilter filter)
Set magnification filter.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: 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.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMinLod(Float lod)
Set minimum level-of-detail parameter.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMaxLod(Float lod)
Set maximum level-of-detail parameter.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setLodBias(Float bias)
Set level-of-detail bias.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setWrapping(const Array2D<SamplerWrapping>& wrapping)
Set wrapping.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setWrapping(const Array2D<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.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setBorderColor(const Color4& color)
Set border color.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setBorderColor(const Vector4ui& color)
Set border color for integer texture.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: 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.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setMaxAnisotropy(Float anisotropy)
Set max anisotropy.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setSRGBDecode(bool decode)
Set sRGB decoding.
Returns | Reference to self (for method chaining) |
---|
See Texture::
template<char r, char g, char b, char a>
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setSwizzle()
Set component swizzle.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompareMode(SamplerCompareMode mode)
Set depth texture comparison mode.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompareFunction(SamplerCompareFunction function)
Set depth texture comparison function.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setDepthStencilMode(SamplerDepthStencilMode mode)
Set depth/stencil texture mode.
Returns | Reference to self (for method chaining) |
---|
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setStorage(Int levels,
TextureFormat internalFormat,
const Vector3i& size)
Set storage.
Returns | Reference to self (for method chaining) |
---|
Z coordinate of size
must be multiple of 6.
See Texture::
Vector3i Magnum:: GL:: CubeMapTextureArray:: imageSize(Int level)
Image size in given mip level.
See Texture::
void Magnum:: GL:: CubeMapTextureArray:: image(Int level,
Image3D& image)
Read given mip level of texture to image.
See Texture::
Image3D Magnum:: GL:: CubeMapTextureArray:: image(Int level,
Image3D&& 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});
void Magnum:: GL:: CubeMapTextureArray:: image(Int level,
BufferImage3D& image,
BufferUsage usage)
Read given mip level of texture to buffer image.
See Texture::
BufferImage3D Magnum:: GL:: CubeMapTextureArray:: image(Int level,
BufferImage3D&& 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);
void Magnum:: GL:: CubeMapTextureArray:: compressedImage(Int level,
CompressedImage3D& image)
Read given mip level of compressed texture to image.
See Texture::
CompressedImage3D Magnum:: GL:: CubeMapTextureArray:: compressedImage(Int level,
CompressedImage3D&& 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, {});
void Magnum:: GL:: CubeMapTextureArray:: compressedImage(Int level,
CompressedBufferImage3D& image,
BufferUsage usage)
Read given mip level of compressed texture to buffer image.
See Texture::
CompressedBufferImage3D Magnum:: GL:: CubeMapTextureArray:: compressedImage(Int level,
CompressedBufferImage3D&& 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);
void Magnum:: GL:: CubeMapTextureArray:: subImage(Int level,
const Range3Di& range,
Image3D& image)
Read range of given texture mip level to image.
See Texture::
Image3D Magnum:: GL:: CubeMapTextureArray:: subImage(Int level,
const Range3Di& range,
Image3D&& 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});
void Magnum:: GL:: CubeMapTextureArray:: subImage(Int level,
const Range3Di& range,
BufferImage3D& image,
BufferUsage usage)
Read range of given texture mip level to buffer image.
See Texture::
BufferImage3D Magnum:: GL:: CubeMapTextureArray:: subImage(Int level,
const Range3Di& range,
BufferImage3D&& 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);
void Magnum:: GL:: CubeMapTextureArray:: compressedSubImage(Int level,
const Range3Di& range,
CompressedImage3D& image)
Read range of given compressed texture mip level to image.
See Texture::
CompressedImage3D Magnum:: GL:: CubeMapTextureArray:: compressedSubImage(Int level,
const Range3Di& range,
CompressedImage3D&& 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, {});
void Magnum:: GL:: CubeMapTextureArray:: compressedSubImage(Int level,
const Range3Di& range,
CompressedBufferImage3D& image,
BufferUsage usage)
Read range of given compressed texture mip level to buffer image.
See Texture::
CompressedBufferImage3D Magnum:: GL:: CubeMapTextureArray:: compressedSubImage(Int level,
const Range3Di& range,
CompressedBufferImage3D&& 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);
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setImage(Int level,
TextureFormat internalFormat,
const ImageView3D& image)
Set image data.
Returns | Reference to self (for method chaining) |
---|
Sets texture image data from three-dimensional image for all cube faces for all layers. Each group of 6 2D images is one cube map layer, thus Z coordinate of image
size must be multiple of 6. The images are in order of (+X, -X, +Y, -Y, +Z, -Z).
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setImage(Int level,
TextureFormat internalFormat,
BufferImage3D& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setImage(Int level,
TextureFormat internalFormat,
BufferImage3D&& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedImage(Int level,
const CompressedImageView3D& image)
Set compressed image data.
Returns | Reference to self (for method chaining) |
---|
Sets texture image data from three-dimensional image for all cube faces for all layers. Each group of 6 2D images is one cube map layer, thus Z coordinate of image
size must be multiple of 6. The images are in order of (+X, -X, +Y, -Y, +Z, -Z).
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedImage(Int level,
CompressedBufferImage3D& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedImage(Int level,
CompressedBufferImage3D&& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setSubImage(Int level,
const Vector3i& offset,
const ImageView3D& image)
Set image subdata.
Returns | Reference to self (for method chaining) |
---|
Z coordinate is equivalent to layer * 6 + number of texture face, i.e. +X is 0
and so on, in order of (+X, -X, +Y, -Y, +Z, -Z).
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setSubImage(Int level,
const Vector3i& offset,
BufferImage3D& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setSubImage(Int level,
const Vector3i& offset,
BufferImage3D&& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedSubImage(Int level,
const Vector3i& offset,
const CompressedImageView3D& image)
Set compressed image subdata.
Returns | Reference to self (for method chaining) |
---|
Z coordinate is equivalent to layer * 6 + number of texture face, i.e. +X is 0
and so on, in order of (+X, -X, +Y, -Y, +Z, -Z).
See Texture::
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedSubImage(Int level,
const Vector3i& offset,
CompressedBufferImage3D& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: setCompressedSubImage(Int level,
const Vector3i& offset,
CompressedBufferImage3D&& image)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
CubeMapTextureArray& Magnum:: GL:: CubeMapTextureArray:: generateMipmap()
Generate mipmap.
Returns | Reference to self (for method chaining) |
---|
See Texture::
void Magnum:: GL:: CubeMapTextureArray:: invalidateImage(Int level)
Invalidate texture image.
See Texture::
void Magnum:: GL:: CubeMapTextureArray:: invalidateSubImage(Int level,
const Vector3i& offset,
const Vector3i& size)
Invalidate texture subimage.
Z coordinate is equivalent to layer * 6 + number of texture face, i.e. +X is 0
and so on, in order of (+X, -X, +Y, -Y, +Z, -Z).
See Texture::