template<UnsignedInt dimensions>
CompressedBufferImage class
Compressed buffer image.
Contents
Stores multi-dimensional compressed image data in GPU memory together with layout and compressed block description. See CompressedImage for the client memory counterpart.
This class can act as a drop-in replacement for CompressedImage, CompressedImageView and Trade::
Basic usage
The image creates a Buffer instance and fills it with passed data, storing corresponding image size and compression format properties. Because this is a GL-centric class, it's common to specify the format using GL::
GL::CompressedBufferImage2D image{GL::CompressedPixelFormat::RGBS3tcDxt1, {512, 256}, data, GL::BufferUsage::StaticDraw};
It's also possible to pass the generic Magnum::
Besides creating and owning the buffer, you can also pass existing buffer to it, for example to use buffer storage and other advanced functionality. The image will take an ownership of the buffer, you can use Buffer::
GL::Buffer buffer; GL::CompressedBufferImage2D image{GL::CompressedPixelFormat::RGBS3tcDxt1, {512, 256}, std::move(buffer), 65536};
It's also possible to create just an image placeholder, storing only the image properties without data or size. That is useful for example to specify desired format of image queries in graphics APIs:
GL::Texture2D texture; GL::CompressedBufferImage2D image = texture.compressedImage(0, {}, GL::BufferUsage::StaticRead);
Similarly to CompressedImageView, this class supports extra storage parameters. See Basic usage for more information.
Public types
- enum (anonymous): UnsignedInt { Dimensions = dimensions }
Constructors, destructors, conversion operators
-
CompressedBufferImage(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers::
ArrayView<const void> data, BufferUsage usage) explicit - Constructor.
-
CompressedBufferImage(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers::
ArrayView<const void> data, BufferUsage usage) explicit - Constructor.
-
CompressedBufferImage(CompressedPixelStorage storage,
Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers:: ArrayView<const void> data, BufferUsage usage) explicit - Constructor.
-
CompressedBufferImage(Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers:: ArrayView<const void> data, BufferUsage usage) explicit - Constructor.
-
CompressedBufferImage(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std::
size_t dataSize) explicit noexcept - Constructor.
-
CompressedBufferImage(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std::
size_t dataSize) explicit noexcept - Construct from existing buffer.
-
CompressedBufferImage(CompressedPixelStorage storage,
Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std:: size_t dataSize) explicit noexcept - Construct from existing buffer.
-
CompressedBufferImage(Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std:: size_t dataSize) explicit noexcept - Construct from existing buffer.
- CompressedBufferImage(CompressedPixelStorage storage)
- Construct an image placeholder.
- CompressedBufferImage()
- Construct an image placeholder.
- CompressedBufferImage(NoCreateT) explicit noexcept
- Construct without creating the underlying OpenGL object.
- CompressedBufferImage(const CompressedBufferImage<dimensions>&) deleted
- Copying is not allowed.
- CompressedBufferImage(CompressedBufferImage<dimensions>&& other) noexcept
- Move constructor.
Public functions
- auto operator=(const CompressedBufferImage<dimensions>&) -> CompressedBufferImage<dimensions>& deleted
- Copying is not allowed.
- auto operator=(CompressedBufferImage<dimensions>&& other) -> CompressedBufferImage<dimensions>& noexcept
- Move assignment.
- auto storage() const -> CompressedPixelStorage
- Storage of compressed pixel data.
- auto format() const -> CompressedPixelFormat
- Format of compressed pixel data.
- auto size() const -> VectorTypeFor<Dimensions, Int>
- Image size.
-
auto dataProperties() const -> std::
pair<VectorTypeFor<dimensions, std:: size_t>, VectorTypeFor<dimensions, std:: size_t>> - Compressed image data properties.
- auto buffer() -> Buffer&
- Image buffer.
-
auto dataSize() const -> std::
size_t - Raw data size.
-
void setData(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers::
ArrayView<const void> data, BufferUsage usage) - Set image data.
-
void setData(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers::
ArrayView<const void> data, BufferUsage usage) - Set image data.
-
void setData(CompressedPixelStorage storage,
Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers:: ArrayView<const void> data, BufferUsage usage) - Set image data.
-
void setData(Magnum::
CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers:: ArrayView<const void> data, BufferUsage usage) - Set image data.
- auto release() -> Buffer
- Release the image buffer.
Enum documentation
template<UnsignedInt dimensions>
enum Magnum:: GL:: CompressedBufferImage<dimensions>:: (anonymous): UnsignedInt
Enumerators | |
---|---|
Dimensions |
Image dimension count |
Function documentation
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage) explicit
Constructor.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage) explicit
Constructor.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Equivalent to calling CompressedBufferImage(CompressedPixelStorage, Magnum::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelStorage storage,
Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage) explicit
Constructor.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Converts Magnum::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage) explicit
Constructor.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Equivalent to calling CompressedBufferImage(CompressedPixelStorage, Magnum::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std:: size_t dataSize) explicit noexcept
Constructor.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
buffer | Buffer |
dataSize | Buffer data size |
If dataSize
is 0
, the buffer is unconditionally reallocated on the first call to setData().
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std:: size_t dataSize) explicit noexcept
Construct from existing buffer.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
buffer | Buffer |
dataSize | Buffer data size |
Equivalent to calling CompressedBufferImage(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelStorage storage,
Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std:: size_t dataSize) explicit noexcept
Construct from existing buffer.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
buffer | Buffer |
dataSize | Buffer data size |
Converts Magnum::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Buffer&& buffer,
std:: size_t dataSize) explicit noexcept
Construct from existing buffer.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
buffer | Buffer |
dataSize | Buffer data size |
Equivalent to calling CompressedBufferImage(CompressedPixelStorage, Magnum::
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(CompressedPixelStorage storage)
Construct an image placeholder.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
Format is undefined, size is zero and buffer is empty, call setData() to fill the image with data.
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage()
Construct an image placeholder.
Equivalent to calling CompressedBufferImage(CompressedPixelStorage) with default-constructed CompressedPixelStorage.
template<UnsignedInt dimensions>
Magnum:: GL:: CompressedBufferImage<dimensions>:: CompressedBufferImage(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.
template<UnsignedInt dimensions>
std:: pair<VectorTypeFor<dimensions, std:: size_t>, VectorTypeFor<dimensions, std:: size_t>> Magnum:: GL:: CompressedBufferImage<dimensions>:: dataProperties() const
Compressed image data properties.
See CompressedPixelStorage::
template<UnsignedInt dimensions>
Buffer& Magnum:: GL:: CompressedBufferImage<dimensions>:: buffer()
Image buffer.
template<UnsignedInt dimensions>
void Magnum:: GL:: CompressedBufferImage<dimensions>:: setData(CompressedPixelStorage storage,
CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage)
Set image data.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Updates the image buffer with given data.
template<UnsignedInt dimensions>
void Magnum:: GL:: CompressedBufferImage<dimensions>:: setData(CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage)
Set image data.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Equivalent to calling setData(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::
template<UnsignedInt dimensions>
void Magnum:: GL:: CompressedBufferImage<dimensions>:: setData(CompressedPixelStorage storage,
Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage)
Set image data.
Parameters | |
---|---|
storage | Storage of compressed pixel data |
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Converts Magnum::
template<UnsignedInt dimensions>
void Magnum:: GL:: CompressedBufferImage<dimensions>:: setData(Magnum:: CompressedPixelFormat format,
const VectorTypeFor<dimensions, Int>& size,
Containers:: ArrayView<const void> data,
BufferUsage usage)
Set image data.
Parameters | |
---|---|
format | Format of compressed pixel data |
size | Image size |
data | Image data |
usage | Image buffer usage |
Equivalent to calling setData(CompressedPixelStorage, Magnum::
template<UnsignedInt dimensions>
Buffer Magnum:: GL:: CompressedBufferImage<dimensions>:: release()
Release the image buffer.
Releases the ownership of the data array and resets size() to zero. The state afterwards is equivalent to moved-from state.