nCine::TextureFormat class

OpenGL pixel format of a texture.

Resolves an OpenGL internal format into the matching external format and pixel data type, tracks whether the data is compressed and verifies that the GPU supports the format.

Public static functions

static auto calculateMipSizes(GLenum internalFormat, std::int32_t width, std::int32_t height, std::int32_t mipMapCount, std::uint32_t* mipDataOffsets, std::uint32_t* mipDataSizes) -> std::uint32_t
Calculates the pixel data offset and size for each MIP map level.

Constructors, destructors, conversion operators

TextureFormat()
TextureFormat(GLenum internalFormat) explicit
TextureFormat(GLenum internalFormat, GLenum type)

Public functions

auto internalFormat() const -> GLenum
Returns the internal format.
auto format() const -> GLenum
Returns the corresponding external format.
auto type() const -> GLenum
Returns the corresponding pixel data type.
auto isCompressed() const -> bool
Returns true if the format holds compressed data.
auto numChannels() const -> std::uint32_t
Returns the number of color channels.
void bgrFormat()
Converts the external format to the corresponding BGR one.