class
#include <nCine/Graphics/Texture.h>
Texture Texture.
Base classes
- class Object
- Base class of nCine objects.
Public types
Public static functions
- static auto sType() -> ObjectType
Constructors, destructors, conversion operators
- Texture()
- Creates an OpenGL texture name.
-
Texture(const char* name,
Format format,
std::
int32_t mipMapCount, std:: int32_t width, std:: int32_t height) - Creates an empty texture with the specified format, MIP levels, and size.
-
Texture(const char* name,
Format format,
std::
int32_t mipMapCount, Vector2i size) - Creates an empty texture with the specified format, MIP levels, and size using a vector.
-
Texture(const char* name,
Format format,
std::
int32_t width, std:: int32_t height) - Creates an empty texture with the specified format and size.
- Texture(const char* name, Format format, Vector2i size)
- Creates an empty texture with the specified format and size using a vector.
- Texture(StringView filename) explicit
- Creates a texture from an image file.
- ~Texture() override
- Texture(const Texture&) deleted
- Texture(Texture&&)
Public functions
- auto operator=(const Texture&) -> Texture& deleted
- auto operator=(Texture&&) -> Texture&
-
void Init(const char* name,
Format format,
std::
int32_t mipMapCount, std:: int32_t width, std:: int32_t height) - Initializes an empty texture with the specified format, MIP levels, and size.
-
void Init(const char* name,
Format format,
std::
int32_t mipMapCount, Vector2i size) - Initializes an empty texture with the specified format, MIP levels, and size using a vector.
-
void Init(const char* name,
Format format,
std::
int32_t width, std:: int32_t height) - Initializes an empty texture with the specified format and size.
- void Init(const char* name, Format format, Vector2i size)
- Initializes an empty texture with the specified format and size using a vector.
- auto LoadFromFile(StringView filename) -> bool
-
auto LoadFromTexels(const std::
uint8_t* bufferPtr) -> bool - Loads all texture texels in raw format from a memory buffer in the first mip level.
-
auto LoadFromTexels(const std::
uint8_t* bufferPtr, std:: int32_t x, std:: int32_t y, std:: int32_t width, std:: int32_t height) -> bool - Loads texels in raw format from a memory buffer to a texture sub-region in the first mip level.
-
auto LoadFromTexels(const std::
uint8_t* bufferPtr, Recti region) -> bool - Loads texels in raw format from a memory buffer to a texture sub-region with a rectangle in the first mip level.
-
auto LoadFromTexels(const std::
uint8_t* bufferPtr, std:: int32_t level, std:: int32_t x, std:: int32_t y, std:: int32_t width, std:: int32_t height) -> bool - Loads texels in raw format from a memory buffer to a specific texture mip level and sub-region.
-
auto LoadFromTexels(const std::
uint8_t* bufferPtr, std:: int32_t level, Recti region) -> bool - Loads texels in raw format from a memory buffer to a specific texture mip level and sub-region with a rectangle.
-
auto SaveToMemory(std::
uint8_t* bufferPtr) -> bool - Saves all texture texels in the first mip level in raw format to a memory buffer.
-
auto SaveToMemory(std::
uint8_t* bufferPtr, std:: int32_t level) -> bool - Saves all texture texels in the specified texture mip level in raw format to a memory buffer.
-
auto GetWidth() const -> std::
int32_t - Returns texture width.
-
auto GetHeight() const -> std::
int32_t - Returns texture height.
-
auto GetMipMapLevels() const -> std::
int32_t - Returns texture MIP map levels.
- auto GetSize() const -> Vector2i
- Returns texture size.
- auto GetRect() const -> Recti
- Returns texture rectangle.
- auto IsCompressed() const -> bool
- Returns
true
if the texture holds compressed data. -
auto GetChannelCount() const -> std::
uint32_t - Returns the number of color channels.
-
auto GetDataSize() const -> std::
uint32_t - Returns the amount of video memory needed to load the texture.
- auto GetMinFiltering() const -> SamplerFilter
- Returns the texture filtering for minification.
- auto GetMagFiltering() const -> SamplerFilter
- Returns the texture filtering for magnification.
- auto GetWrap() const -> SamplerWrapping
- Returns texture wrap for both
s
andt
coordinates. - void SetMinFiltering(SamplerFilter filter)
- Sets the texture filtering for minification.
- void SetMagFiltering(SamplerFilter filter)
- Sets the texture filtering for magnification.
- void SetWrap(SamplerWrapping wrapMode)
- Sets texture wrap for both
s
andt
coordinates. - void SetGLTextureLabel(const char* label)
- Sets the OpenGL object label for the texture.
- auto GetGuiTexId() const -> void*
- Returns the user data opaque pointer for ImGui's
ImTextureID