Texture2D class
#include <core/gl/render_device.hpp>
Abstract 2D texture.
Public functions
- void update(std::size_t x, std::size_t y, std::size_t width, std::size_t height, const void* data, std::size_t level = 0) pure virtual
- Updates the texture with new data, which must have the same format used when the texture was created.
- void read(void* outputBuffer) pure virtual
- Reads texture data into a buffer, which must have the same format used when the texture was created.
-
void copyTo(std::size_t x,
std::size_t y,
std::size_t width,
std::size_t height,
gl::
PixelPackBuffer buffer) pure virtual - Copies part of the texture data into a pixel pack buffer.
- void generateMipmaps() pure virtual
- Generates mipmaps on this texture.
Function documentation
void cubos:: core:: gl:: impl:: Texture2D:: update(std::size_t x,
std::size_t y,
std::size_t width,
std::size_t height,
const void* data,
std::size_t level = 0) pure virtual
Updates the texture with new data, which must have the same format used when the texture was created.
| Parameters | |
|---|---|
| x | Destination X coordinate. |
| y | Destination Y coordinate. |
| width | Width of the section which will be updated. |
| height | Height of the section which will be updated. |
| data | Pointer to the new data. |
| level | Mip level to update. |
void cubos:: core:: gl:: impl:: Texture2D:: read(void* outputBuffer) pure virtual
Reads texture data into a buffer, which must have the same format used when the texture was created.
| Parameters | |
|---|---|
| outputBuffer | Buffer to write the data to. |
void cubos:: core:: gl:: impl:: Texture2D:: copyTo(std::size_t x,
std::size_t y,
std::size_t width,
std::size_t height,
gl:: PixelPackBuffer buffer) pure virtual
Copies part of the texture data into a pixel pack buffer.
| Parameters | |
|---|---|
| x | Source X coordinate. |
| y | Source Y coordinate. |
| width | Width of the section which will be copied. |
| height | Height of the section which will be copied. |
| buffer | Buffer to copy into. |
The output buffer will store data in one of the three following formats:
- If the texture format ends with
Norm, then the output format will be TextureFormat::RGBA8UInt. - If the texture format ends with
SInt, then the output format will be TextureFormat::RGBA32SInt. - If the texture format ends with
UInt, then the output format will be TextureFormat::RGBA32UInt. - Otherwise, the output format will be TextureFormat::
RGBA32Float.