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 width() const -> std::
int32_t - Returns texture width.
-
auto height() const -> std::
int32_t - Returns texture height.
-
auto mipMapLevels() const -> std::
int32_t - Returns texture MIP map levels.
- auto size() const -> Vector2i
- Returns texture size.
- auto rect() const -> Recti
- Returns texture rectangle.
- auto isCompressed() const -> bool
- Returns
true
if the texture holds compressed data. -
auto numChannels() const -> std::
uint32_t - Returns the number of color channels.
-
auto dataSize() const -> std::
uint32_t - Returns the amount of video memory needed to load the texture.
- auto minFiltering() const -> SamplerFilter
- Returns the texture filtering for minification.
- auto magFiltering() const -> SamplerFilter
- Returns the texture filtering for magnification.
- auto wrap() 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 guiTexId() const -> void*
- Returns the user data opaque pointer for ImGui's
ImTextureID