![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Standard opengl texture. More...
#include <Texture2D.hpp>
Public Member Functions | |
Texture2D () | |
Constructor. | |
Texture2D (Texture2D &&) | |
Move constructor. | |
Texture2D & | operator= (Texture2D &&) |
Move assignment operator. | |
virtual | ~Texture2D () |
Destructor. | |
bool | load (const std::string &file) |
Load a texture from vfs. | |
bool | load_mem (std::span< std::uint8_t > buffer) |
Loads texture from memory. | |
void | save (std::string_view file) |
Saves texture to file on disk. | |
void | recreate () |
Deletes texture data and configuration in OpenGL and creates new texture handle. | |
void | bind () override |
Activate context. | |
void | unbind () override |
Deactivate context. | |
![]() | |
Texture (Texture &&) | |
Move constructor. | |
Texture & | operator= (Texture &&) |
Move assignment operator. | |
virtual | ~Texture () |
Destructor. | |
TextureView | make_view (const unsigned int minlevel=0, const unsigned int numlevels=1, const unsigned int minlayer=0, const unsigned int numlayers=1) |
Create a texture view. | |
void | mode (const TextureMode mode) |
Set texture mode. | |
TextureMode | mode () const |
Get texture mode. | |
void | filter (const TextureFilter filter) |
Set filter when texture is (up/down)scaled in OpenGL. | |
TextureFilter | filter () const |
Get texture filter. | |
void | anisotropy (const int level) |
Set ansiotropic filtering level. | |
int | anisotropy () const |
Get current anisotropy level. | |
float | width () const |
Get texture width. | |
float | height () const |
Get texture height. | |
unsigned int | id () const |
Gets opengl handle. | |
Additional Inherited Members | |
![]() | |
Texture () | |
Constructor. | |
![]() | |
unsigned int | m_id |
OpenGL id. | |
int | m_width |
Cached width. | |
int | m_height |
Cached height. | |
TextureMode | m_mode |
Mode. | |
TextureFilter | m_filter |
Filter. | |
int | m_anisotropy |
Ansiotrophy level. | |
Standard opengl texture.
Definition at line 20 of file Texture2D.hpp.
galaxy::graphics::Texture2D::Texture2D | ( | ) |
Constructor.
Definition at line 27 of file Texture2D.cpp.
galaxy::graphics::Texture2D::Texture2D | ( | Texture2D && | t | ) |
Move constructor.
Definition at line 33 of file Texture2D.cpp.
|
virtual |
Destructor.
Definition at line 48 of file Texture2D.cpp.
Move assignment operator.
Definition at line 38 of file Texture2D.cpp.
|
nodiscard |
Load a texture from vfs.
file | Texture in VFS to load. |
Definition at line 52 of file Texture2D.cpp.
|
nodiscard |
Loads texture from memory.
Loads from standard 256 byte array.
buffer | Memory buffer to load from. |
Definition at line 69 of file Texture2D.cpp.
void galaxy::graphics::Texture2D::save | ( | std::string_view | file | ) |
Saves texture to file on disk.
file | Path and filename to save texture to. Does not need extension (it will be ignored). |
Definition at line 107 of file Texture2D.cpp.
void galaxy::graphics::Texture2D::recreate | ( | ) |
Deletes texture data and configuration in OpenGL and creates new texture handle.
Definition at line 144 of file Texture2D.cpp.
|
overridevirtual |
Activate context.
Implements galaxy::graphics::Texture.
Definition at line 155 of file Texture2D.cpp.
|
overridevirtual |
Deactivate context.
Implements galaxy::graphics::Texture.
Definition at line 160 of file Texture2D.cpp.