![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Bindless OpenGL 2D Texture. More...
#include <Texture.hpp>
Public Member Functions | |
Texture () | |
Constructor. | |
Texture (Texture &&) noexcept | |
Move constructor. | |
Texture & | operator= (Texture &&) noexcept |
Move assignment operator. | |
~Texture () | |
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 | bind () const noexcept |
Bind to sampler. | |
void | unbind () const noexcept |
Deactivate sampler. | |
void | destroy () |
Destroy texture. | |
void | recreate () |
Deletes texture data and configuration in OpenGL. | |
float | width () const noexcept |
Get texture width. | |
float | height () const noexcept |
Get texture height. | |
unsigned int | id () const noexcept |
Get OpenGL texture id. | |
std::uint64_t | handle () const noexcept |
Get OpenGL bindless handle. | |
Private Member Functions | |
Texture (const Texture &)=delete | |
Copy constructor. | |
Texture & | operator= (const Texture &)=delete |
Copy assignment operator. | |
void | set_filter () const noexcept |
Sets filter when texture is (up/down)scaled in OpenGL. | |
void | set_mode () const noexcept |
Set texture mode. | |
void | set_anisotropy () const noexcept |
Set ansiotropic filtering level. | |
Private Attributes | |
unsigned int | m_id |
OpenGL id. | |
std::uint64_t | m_handle |
Bindless handle. | |
int | m_width |
Texture width. | |
int | m_height |
Texture height. | |
Bindless OpenGL 2D Texture.
https://ktstephano.github.io/rendering/opengl/bindless
Definition at line 21 of file Texture.hpp.
galaxy::Texture::Texture | ( | ) |
Constructor.
Definition at line 28 of file Texture.cpp.
|
noexcept |
Move constructor.
Definition at line 37 of file Texture.cpp.
galaxy::Texture::~Texture | ( | ) |
|
privatedelete |
Copy constructor.
Move assignment operator.
Definition at line 50 of file Texture.cpp.
|
nodiscard |
Load a texture from vfs.
file | Texture in VFS to load. |
Definition at line 73 of file Texture.cpp.
|
nodiscard |
Loads texture from memory.
Loads from standard 256byte array.
buffer | Memory buffer to load from. |
Definition at line 81 of file Texture.cpp.
void galaxy::Texture::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 119 of file Texture.cpp.
|
noexcept |
Bind to sampler.
Not required because this supports bindless textures.
Definition at line 157 of file Texture.cpp.
|
noexcept |
Deactivate sampler.
Definition at line 162 of file Texture.cpp.
void galaxy::Texture::destroy | ( | ) |
Destroy texture.
Definition at line 167 of file Texture.cpp.
void galaxy::Texture::recreate | ( | ) |
Deletes texture data and configuration in OpenGL.
You need to call load again!
Definition at line 182 of file Texture.cpp.
|
nodiscardnoexcept |
Get texture width.
Is cached for performance.
Definition at line 188 of file Texture.cpp.
|
nodiscardnoexcept |
Get texture height.
Is cached for performance.
Definition at line 193 of file Texture.cpp.
|
nodiscardnoexcept |
Get OpenGL texture id.
Definition at line 198 of file Texture.cpp.
|
nodiscardnoexcept |
Get OpenGL bindless handle.
Definition at line 203 of file Texture.cpp.
|
privatenoexcept |
Sets filter when texture is (up/down)scaled in OpenGL.
Includes mipmapping.
Definition at line 208 of file Texture.cpp.
|
privatenoexcept |
Set texture mode.
I.e. REPEAT, CLAMP_TO_EDGE, etc.
Definition at line 245 of file Texture.cpp.
|
privatenoexcept |
Set ansiotropic filtering level.
Definition at line 251 of file Texture.cpp.
|
private |
OpenGL id.
Definition at line 167 of file Texture.hpp.
|
private |
Bindless handle.
Definition at line 172 of file Texture.hpp.
|
private |
Texture width.
Definition at line 177 of file Texture.hpp.
|
private |
Texture height.
Definition at line 182 of file Texture.hpp.