Magnum::GL::CubeMapTexture class

Cube map texture.

Texture used mainly for environment maps. It consists of 6 square textures generating 6 faces of the cube as following. Note that all images must be turned upside down (+Y is top):

          +----+
          | -Y |
+----+----+----+----+
| -Z | -X | +Z | +X |
+----+----+----+----+
          | +Y |
          +----+

Basic usage

See Texture documentation for introduction.

Common usage is to fully configure all texture parameters and then set the data from e.g. set of Image objects:

ImageView2D positiveX(GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte, {256, 256}, data);
// ...

GL::CubeMapTexture texture;
texture.setMagnificationFilter(GL::SamplerFilter::Linear)
    // ...
    .setStorage(Math::log2(256)+1, GL::TextureFormat::RGBA8, {256, 256})
    .setSubImage(GL::CubeMapCoordinate::PositiveX, 0, {}, positiveX)
    .setSubImage(GL::CubeMapCoordinate::NegativeX, 0, {}, negativeX)
    // ...

In shader, the texture is used via samplerCube, samplerCubeShadow, isamplerCube or usamplerCube. Unlike in classic textures, coordinates for cube map textures is signed three-part vector from the center of the cube, which intersects one of the six sides of the cube map. See AbstractShaderProgram for more information about usage in shaders.

Base classes

class AbstractTexture
Base for textures.

Public static functions

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

Constructors, destructors, conversion operators

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

Public functions

auto operator=(const CubeMapTexture&) -> CubeMapTexture& deleted
Copying is not allowed.
auto operator=(CubeMapTexture&&) -> CubeMapTexture& defaulted noexcept
Move assignment.
void bindImage(Int imageUnit, Int level, CubeMapCoordinate coordinate, ImageAccess access, ImageFormat format)
Bind level of given cube map texture coordinate to given image unit.
void bindImageLayered(Int imageUnit, Int level, ImageAccess access, ImageFormat format)
Bind level of layered cube map texture to given image unit.
auto setBaseLevel(Int level) -> CubeMapTexture&
Set base mip level.
auto setMaxLevel(Int level) -> CubeMapTexture&
Set max mip level.
auto setMinificationFilter(SamplerFilter filter, SamplerMipmap mipmap = SamplerMipmap::Base) -> CubeMapTexture&
Set minification filter.
auto setMinificationFilter(Magnum::SamplerFilter filter, Magnum::SamplerMipmap mipmap = Magnum::SamplerMipmap::Base) -> CubeMapTexture&
auto setMagnificationFilter(SamplerFilter filter) -> CubeMapTexture&
Set magnification filter.
auto setMagnificationFilter(Magnum::SamplerFilter filter) -> CubeMapTexture&
auto setMinLod(Float lod) -> CubeMapTexture&
Set the minimum level-of-detail.
auto setMaxLod(Float lod) -> CubeMapTexture&
Set the maximum level-of-detail.
auto setLodBias(Float bias) -> CubeMapTexture&
Set level-of-detail bias.
auto setWrapping(const Math::Vector2<SamplerWrapping>& wrapping) -> CubeMapTexture&
Set wrapping.
auto setWrapping(const Math::Vector2<Magnum::SamplerWrapping>& wrapping) -> CubeMapTexture&
auto setWrapping(SamplerWrapping wrapping) -> CubeMapTexture&
Set the same wrapping for all dimensions.
auto setWrapping(Magnum::SamplerWrapping wrapping) -> CubeMapTexture&
auto setBorderColor(const Color4& color) -> CubeMapTexture&
Set border color.
auto setBorderColor(const Vector4ui& color) -> CubeMapTexture&
Set border color for integer texture.
auto setBorderColor(const Vector4i& color) -> CubeMapTexture&
auto setMaxAnisotropy(Float anisotropy) -> CubeMapTexture&
Set max anisotropy.
auto setSrgbDecode(bool decode) -> CubeMapTexture&
Set sRGB decoding.
template<char r, char g, char b, char a>
auto setSwizzle() -> CubeMapTexture&
Set component swizzle.
auto setCompareMode(SamplerCompareMode mode) -> CubeMapTexture&
Set depth texture comparison mode.
auto setCompareFunction(SamplerCompareFunction function) -> CubeMapTexture&
Set depth texture comparison function.
auto setDepthStencilMode(SamplerDepthStencilMode mode) -> CubeMapTexture&
Set depth/stencil texture mode.
auto setStorage(Int levels, TextureFormat internalFormat, const Vector2i& size) -> CubeMapTexture&
Set storage.
auto imageSize(Int level) -> Vector2i
Image size in given mip level.
void image(Int level, Image3D& image)
Read given texture mip level to an image.
auto image(Int level, Image3D&& image) -> Image3D
void image(Int level, const MutableImageView3D& image)
Read given texture mip level to an image view.
void image(Int level, BufferImage3D& image, BufferUsage usage)
Read given texture mip level to a buffer image.
auto image(Int level, BufferImage3D&& image, BufferUsage usage) -> BufferImage3D
void compressedImage(Int level, CompressedImage3D& image)
Read given mip level of a compressed texture to an image.
auto compressedImage(Int level, CompressedImage3D&& image) -> CompressedImage3D
void compressedImage(Int level, const MutableCompressedImageView3D& image)
Read given compressed texture mip level to an image view.
void compressedImage(Int level, CompressedBufferImage3D& image, BufferUsage usage)
Read given compressed texture mip level to a buffer image.
auto compressedImage(Int level, CompressedBufferImage3D&& image, BufferUsage usage) -> CompressedBufferImage3D
void image(CubeMapCoordinate coordinate, Int level, Image2D& image)
Read given texture mip level and coordinate to an image.
auto image(CubeMapCoordinate coordinate, Int level, Image2D&& image) -> Image2D
void image(CubeMapCoordinate coordinate, Int level, const MutableImageView2D& image) new in 2019.10
Read given texture mip level and coordinate to an image view.
void image(CubeMapCoordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage)
Read given texture mip level and coordinate to a buffer image.
auto image(CubeMapCoordinate coordinate, Int level, BufferImage2D&& image, BufferUsage usage) -> BufferImage2D
void compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D& image)
Read given compressed texture mip level and coordinate to an image.
auto compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D&& image) -> CompressedImage2D
void compressedImage(CubeMapCoordinate coordinate, Int level, const MutableCompressedImageView2D& image) new in 2019.10
Read given compressed texture mip level to an image view.
void compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image, BufferUsage usage)
Read given compressed texture mip level and coordinate to a buffer image.
auto compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& image, BufferUsage usage) -> CompressedBufferImage2D
void subImage(Int level, const Range3Di& range, Image3D& image)
Read a range of given texture mip level to an image.
auto subImage(Int level, const Range3Di& range, Image3D&& image) -> Image3D
void subImage(Int level, const Range3Di& range, const MutableImageView3D& image) new in 2019.10
Read a range of given texture mip level to an image view.
void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage)
Read a range of given texture mip level to a buffer image.
auto subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage) -> BufferImage3D
void compressedSubImage(Int level, const Range3Di& range, CompressedImage3D& image)
Read a range of given compressed texture mip level to an image.
auto compressedSubImage(Int level, const Range3Di& range, CompressedImage3D&& image) -> CompressedImage3D
void compressedSubImage(Int level, const Range3Di& range, const MutableCompressedImageView3D& image) new in 2019.10
Read a range of given compressed texture mip level to an image view.
void compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D& image, BufferUsage usage)
Read a range of given compressed texture mip level to a buffer image.
auto compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D&& image, BufferUsage usage) -> CompressedBufferImage3D
auto setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, const ImageView2D& image) -> CubeMapTexture&
Set image data.
auto setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) -> CubeMapTexture&
auto setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D&& image) -> CubeMapTexture&
auto setCompressedImage(CubeMapCoordinate coordinate, Int level, const CompressedImageView2D& image) -> CubeMapTexture&
Set compressed image data.
auto setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image) -> CubeMapTexture&
auto setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& image) -> CubeMapTexture&
auto setSubImage(Int level, const Vector3i& offset, const ImageView3D& image) -> CubeMapTexture&
Set image subdata.
auto setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) -> CubeMapTexture&
auto setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) -> CubeMapTexture&
auto setCompressedSubImage(Int level, const Vector3i& offset, const CompressedImageView3D& image) -> CubeMapTexture&
Set compressed image subdata.
auto setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D& image) -> CubeMapTexture&
auto setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D&& image) -> CubeMapTexture&
auto setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const ImageView2D& image) -> CubeMapTexture&
Set image subdata.
auto setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image) -> CubeMapTexture&
auto setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) -> CubeMapTexture&
auto setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const CompressedImageView2D& image) -> CubeMapTexture&
Set compressed image subdata.
auto setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D& image) -> CubeMapTexture&
auto setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D&& image) -> CubeMapTexture&
auto generateMipmap() -> CubeMapTexture&
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 Vector2i Magnum::GL::CubeMapTexture::maxSize()

Max supported size of one side of cube map texture.

The result is cached, repeated queries don't result in repeated OpenGL calls.

static Vector2i Magnum::GL::CubeMapTexture::compressedBlockSize(TextureFormat format)

Compressed block size.

See Texture::compressedBlockSize() for more information.

static Int Magnum::GL::CubeMapTexture::compressedBlockDataSize(TextureFormat format)

Compressed block data size.

See Texture::compressedBlockDataSize() for more information.

static CubeMapTexture Magnum::GL::CubeMapTexture::view(CubeMapTexture& original, TextureFormat internalFormat, Int levelOffset, Int levelCount) new in Git master

Create a view on another cube map 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.

static CubeMapTexture Magnum::GL::CubeMapTexture::view(CubeMapTextureArray& original, TextureFormat internalFormat, Int levelOffset, Int levelCount, Int layerOffset) new in Git master

Create a view on a cube map 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.

static CubeMapTexture Magnum::GL::CubeMapTexture::wrap(GLuint id, ObjectFlags flags = {})

Wrap existing OpenGL cube map texture object.

Parameters
id OpenGL cube map texture ID
flags Object creation flags

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

Magnum::GL::CubeMapTexture::CubeMapTexture() 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.

Magnum::GL::CubeMapTexture::CubeMapTexture(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.

void Magnum::GL::CubeMapTexture::bindImage(Int imageUnit, Int level, CubeMapCoordinate coordinate, ImageAccess access, ImageFormat format)

Bind level of given cube map texture coordinate to given image unit.

Parameters
imageUnit Image unit
level Texture level
coordinate Cube map coordinate
access Image access
format Image format

void Magnum::GL::CubeMapTexture::bindImageLayered(Int imageUnit, Int level, ImageAccess access, ImageFormat format)

Bind level of layered cube map texture to given image unit.

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setBaseLevel(Int level)

Set base mip level.

Returns Reference to self (for method chaining)

See Texture::setBaseLevel() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMaxLevel(Int level)

Set max mip level.

Returns Reference to self (for method chaining)

See Texture::setMaxLevel() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMinificationFilter(SamplerFilter filter, SamplerMipmap mipmap = SamplerMipmap::Base)

Set minification filter.

Returns Reference to self (for method chaining)

See Texture::setMinificationFilter() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMagnificationFilter(SamplerFilter filter)

Set magnification filter.

Returns Reference to self (for method chaining)

See Texture::setMagnificationFilter() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMinLod(Float lod)

Set the minimum level-of-detail.

Returns Reference to self (for method chaining)

See Texture::setMinLod() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMaxLod(Float lod)

Set the maximum level-of-detail.

Returns Reference to self (for method chaining)

See Texture::setMaxLod() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setLodBias(Float bias)

Set level-of-detail bias.

Returns Reference to self (for method chaining)

See Texture::setLodBias() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setWrapping(const Math::Vector2<SamplerWrapping>& wrapping)

Set wrapping.

Returns Reference to self (for method chaining)

See Texture::setWrapping() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setWrapping(const Math::Vector2<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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setWrapping(SamplerWrapping wrapping)

Set the same wrapping for all dimensions.

Returns Reference to self (for method chaining)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setBorderColor(const Color4& color)

Set border color.

Returns Reference to self (for method chaining)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setMaxAnisotropy(Float anisotropy)

Set max anisotropy.

Returns Reference to self (for method chaining)

See Texture::setMaxAnisotropy() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setSrgbDecode(bool decode)

Set sRGB decoding.

Returns Reference to self (for method chaining)

See Texture::setSrgbDecode() for more information.

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

Set component swizzle.

Returns Reference to self (for method chaining)

See Texture::setSwizzle() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompareMode(SamplerCompareMode mode)

Set depth texture comparison mode.

Returns Reference to self (for method chaining)

See Texture::setCompareMode() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompareFunction(SamplerCompareFunction function)

Set depth texture comparison function.

Returns Reference to self (for method chaining)

See Texture::setCompareFunction() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setDepthStencilMode(SamplerDepthStencilMode mode)

Set depth/stencil texture mode.

Returns Reference to self (for method chaining)

See Texture::setDepthStencilMode() for more information.

CubeMapTexture& Magnum::GL::CubeMapTexture::setStorage(Int levels, TextureFormat internalFormat, const Vector2i& size)

Set storage.

Returns Reference to self (for method chaining)

See Texture::setStorage() for more information.

Vector2i Magnum::GL::CubeMapTexture::imageSize(Int level)

Image size in given mip level.

If ARB_direct_state_access (part of OpenGL 4.5) is not available, it is assumed that faces have the same size and just the size of CubeMapCoordinate::PositiveX face is queried. See Texture::imageSize() for more information.

void Magnum::GL::CubeMapTexture::image(Int level, Image3D& image)

Read given texture mip level to an image.

Image parameters like format and type of pixel data are taken from given image, image size is taken from the texture using imageSize(). Flags of image get reset to ImageFlag3D::CubeMap. The storage is not reallocated if it is large enough to contain the new data — however if you want to read into existing memory or ensure a reallocation does not happen, use image(Int, const MutableImageView3D&) instead.

If ARB_direct_state_access (part of OpenGL 4.5) is not available, the texture is bound before the operation (if not already) and the image is downloaded slice by slice. If either ARB_get_texture_sub_image or ARB_robustness is available, the operation is protected from buffer overflow.

Image3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::image(Int level, const MutableImageView3D& image)

Read given texture mip level to an image view.

Compared to image(Int, Image3D&) 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 a cube map texture to an image marked as 2D array.

void Magnum::GL::CubeMapTexture::image(Int level, BufferImage3D& image, BufferUsage usage)

Read given texture mip level to a buffer image.

See image(Int, Image3D&) for more information. The storage is not reallocated if it is large enough to contain the new data, which means that usage might get ignored.

BufferImage3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::compressedImage(Int level, CompressedImage3D& image)

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

Compression format and data size are taken from the texture, image size is taken using imageSize(). Flags of image get reset to ImageFlag3D::CubeMap. The storage is not reallocated if it is large enough to contain the new data — however if you want to read into existing memory or ensure a reallocation does not happen, use compressedImage(Int, const MutableCompressedImageView3D&) instead.

CompressedImage3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::compressedImage(Int level, const MutableCompressedImageView3D& image)

Read given compressed texture mip level to an image view.

Compared to compressedImage(Int, CompressedImage3D&) 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 a cube map texture to an image marked as 2D array.

void Magnum::GL::CubeMapTexture::compressedImage(Int level, CompressedBufferImage3D& image, BufferUsage usage)

Read given compressed texture mip level to a buffer image.

See compressedImage(Int, CompressedImage3D&) for more information. The storage is not reallocated if it is large enough to contain the new data, which means that usage might get ignored.

CompressedBufferImage3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::image(CubeMapCoordinate coordinate, Int level, Image2D& image)

Read given texture mip level and coordinate to an image.

Image parameters like format and type of pixel data are taken from given image, image size is taken from the texture using imageSize(). Flags of image get cleared — use image(Int, Image3D&) instead if you want to get an image annotated with ImageFlag3D::CubeMap. The storage is not reallocated if it is large enough to contain the new data — however if you want to read into existing memory or ensure a reallocation does not happen, use image(CubeMapCoordinate, Int, const MutableImageView2D&) instead.

If ARB_get_texture_sub_image (part of OpenGL 4.5) is not available, the texture is bound before the operation (if not already). If either ARB_get_texture_sub_image or ARB_robustness is available, the operation is protected from buffer overflow.

Image2D Magnum::GL::CubeMapTexture::image(CubeMapCoordinate coordinate, Int level, Image2D&& 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:

Image2D image = texture.image(GL::CubeMapCoordinate::PositiveX, 0,
    {PixelFormat::RGBA8Unorm});

void Magnum::GL::CubeMapTexture::image(CubeMapCoordinate coordinate, Int level, const MutableImageView2D& image) new in 2019.10

Read given texture mip level and coordinate to an image view.

Compared to image(CubeMapCoordinate, Int, Image2D&) 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 a cube map texture face to an image marked as 1D array.

void Magnum::GL::CubeMapTexture::image(CubeMapCoordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage)

Read given texture mip level and coordinate to a buffer image.

See image(CubeMapCoordinate, Int, Image2D&) for more information. The storage is not reallocated if it is large enough to contain the new data, which means that usage might get ignored.

BufferImage2D Magnum::GL::CubeMapTexture::image(CubeMapCoordinate coordinate, Int level, BufferImage2D&& 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::BufferImage2D image = texture.image(GL::CubeMapCoordinate::PositiveX, 0,
    {PixelFormat::RGBA8Unorm}, GL::BufferUsage::StaticRead);

void Magnum::GL::CubeMapTexture::compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D& image)

Read given compressed texture mip level and coordinate to an image.

Compression format and data size are taken from the texture, image size is taken using imageSize(). Flags of image get cleared — use compressedImage(Int, CompressedImage3D&) instead if you want to get an image annotated with ImageFlag3D::CubeMap. The storage is not reallocated if it is large enough to contain the new data — however if you want to read into existing memory or ensure a reallocation does not happen, use compressedImage(CubeMapCoordinate, Int, const MutableCompressedImageView2D&) instead.

If ARB_get_texture_sub_image (part of OpenGL 4.5) is not available, the texture is bound before the operation (if not already). If either ARB_get_texture_sub_image or ARB_robustness is available, the operation is protected from buffer overflow.

CompressedImage2D Magnum::GL::CubeMapTexture::compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D&& 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:

CompressedImage2D image = texture.compressedImage(GL::CubeMapCoordinate::PositiveX,
    0, {});

void Magnum::GL::CubeMapTexture::compressedImage(CubeMapCoordinate coordinate, Int level, const MutableCompressedImageView2D& image) new in 2019.10

Read given compressed texture mip level to an image view.

Compared to compressedImage(CubeMapCoordinate, Int, CompressedImage2D&) 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 a cube map texture face to an image marked as 1D array.

void Magnum::GL::CubeMapTexture::compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image, BufferUsage usage)

Read given compressed texture mip level and coordinate to a buffer image.

See compressedImage(CubeMapCoordinate, Int, CompressedImage2D&) for more information. The storage is not reallocated if it is large enough to contain the new data, which means that usage might get ignored.

CompressedBufferImage2D Magnum::GL::CubeMapTexture::compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& 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::CompressedBufferImage2D image = texture.compressedImage(GL::CubeMapCoordinate::PositiveX,
    0, {}, GL::BufferUsage::StaticRead);

void Magnum::GL::CubeMapTexture::subImage(Int level, const Range3Di& range, Image3D& 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 ImageFlag3D::Array (as opposed to ImageFlag3D::CubeMap when using image(Int, Image3D&)).

Image3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::subImage(Int level, const Range3Di& range, const MutableImageView3D& image) new in 2019.10

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

Compared to subImage(Int, const Range3Di&, Image3D&) 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 a cube map texture to an image marked as 2D array.

void Magnum::GL::CubeMapTexture::subImage(Int level, const Range3Di& range, BufferImage3D& 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.

BufferImage3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::compressedSubImage(Int level, const Range3Di& range, CompressedImage3D& 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 ImageFlag3D::Array (as opposed to ImageFlag3D::CubeMap when using compressedImage(Int, CompressedImage3D&)).

CompressedImage3D Magnum::GL::CubeMapTexture::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::CubeMapTexture::compressedSubImage(Int level, const Range3Di& range, const MutableCompressedImageView3D& image) new in 2019.10

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

Compared to compressedSubImage(Int, const Range3Di&, CompressedImage3D&) 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 a cube map texture to an image marked as 2D array.

void Magnum::GL::CubeMapTexture::compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D& 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.

CompressedBufferImage3D Magnum::GL::CubeMapTexture::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);

CubeMapTexture& Magnum::GL::CubeMapTexture::setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, const ImageView2D& 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 marked as 1D array to a cube map face.

CubeMapTexture& Magnum::GL::CubeMapTexture::setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D&& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedImage(CubeMapCoordinate coordinate, Int level, const CompressedImageView2D& 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 marked as 1D array to a cube map face.

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setSubImage(Int level, const Vector3i& offset, const ImageView3D& image)

Set image subdata.

Parameters
level Mip level
offset Offset where to put data in the texture
image Image3D, ImageView3D or Trade::ImageData3D
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) and the image is uploaded slice by slice.

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.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedSubImage(Int level, const Vector3i& offset, const CompressedImageView3D& image)

Set compressed image subdata.

Parameters
level Mip level
offset Offset where to put data in the texture
image CompressedImage3D, CompressedImageView3D or compressed Trade::ImageData3D
Returns Reference to self (for method chaining)

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.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::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.

CubeMapTexture& Magnum::GL::CubeMapTexture::setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const ImageView2D& image)

Set image subdata.

Returns Reference to self (for method chaining)

Behavior equivalent to Texture::setSubImage(), see its documentation for more information. Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image marked as 1D array to a cube map face.

CubeMapTexture& Magnum::GL::CubeMapTexture::setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const CompressedImageView2D& image)

Set compressed image subdata.

Returns Reference to self (for method chaining)

Behavior equivalent to Texture::setCompressedSubImage(), see its documentation for more information. Any set of ImageFlags is allowed in image — e.g., it's possible to upload an image marked as 1D array to a cube map face.

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D&& image)

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

CubeMapTexture& Magnum::GL::CubeMapTexture::generateMipmap()

Generate mipmap.

Returns Reference to self (for method chaining)

See Texture::generateMipmap() for more information.

void Magnum::GL::CubeMapTexture::invalidateImage(Int level)

Invalidate texture image.

See Texture::invalidateImage() for more information.

void Magnum::GL::CubeMapTexture::invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size)

Invalidate texture subimage.

Z coordinate is equivalent to number of texture face, i.e. CubeMapCoordinate::PositiveX is 0 and so on, in the same order as in the enum.

See Texture::invalidateSubImage() for more information.