![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Draw to an opengl texture instead of the screen. More...
#include <RenderTexture.hpp>
Public Member Functions | |
RenderTexture () | |
Constructor. | |
RenderTexture (RenderTexture &&) | |
Move constructor. | |
RenderTexture & | operator= (RenderTexture &&) |
Move assignment operator. | |
virtual | ~RenderTexture () |
Destructor. | |
void | create (const int width, const int height) |
Create framebuffer and texture. | |
void | recreate (const int width=-1, const int height=-1) |
Destroy and re-create framebuffer. | |
void | save (std::string_view file) |
Saves texture to file on disk. | |
void | bind (bool clear=true) |
Activate context. | |
void | unbind () |
Deactivate context. | |
void | clear () |
Clear framebuffer attachments. | |
int | width () const |
Get texture width. | |
int | height () const |
Get texture height. | |
unsigned int | texture () const |
Gets framebuffer texture. | |
const glm::mat4 & | get_proj () |
Get render texture projection. | |
Framebuffer & | fbo () |
Get framebuffer. | |
Private Member Functions | |
RenderTexture (const RenderTexture &)=delete | |
Copy constructor. | |
RenderTexture & | operator= (const RenderTexture &)=delete |
Copy assignment operator. | |
Private Attributes | |
int | m_width |
Cached width. | |
int | m_height |
Cached height. | |
Framebuffer | m_framebuffer |
OpenGL framebuffer abstraction. | |
glm::mat4 | m_proj |
Projection. | |
Draw to an opengl texture instead of the screen.
Definition at line 24 of file RenderTexture.hpp.
galaxy::graphics::RenderTexture::RenderTexture | ( | ) |
Constructor.
Definition at line 27 of file RenderTexture.cpp.
galaxy::graphics::RenderTexture::RenderTexture | ( | RenderTexture && | rt | ) |
Move constructor.
Definition at line 33 of file RenderTexture.cpp.
|
virtual |
Destructor.
Definition at line 52 of file RenderTexture.cpp.
|
privatedelete |
Copy constructor.
RenderTexture & galaxy::graphics::RenderTexture::operator= | ( | RenderTexture && | rt | ) |
Move assignment operator.
Definition at line 40 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::create | ( | const int | width, |
const int | height ) |
Create framebuffer and texture.
width | Width of the render target. Must be greater than 0. |
height | Height of the render target. Must be greater than 0. |
Definition at line 56 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::recreate | ( | const int | width = -1, |
const int | height = -1 ) |
Destroy and re-create framebuffer.
You will need to mark it bindless again.
width | Optional. Will use existing size otherwise. Width of the render target. Must be greater than 0. |
height | Optional. Will use existing size otherwise. Height of the render target. Must be greater than 0. |
Definition at line 69 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::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 82 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::bind | ( | bool | clear = true | ) |
Activate context.
clear | Clear framebuffer after binding. |
Definition at line 119 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::unbind | ( | ) |
Deactivate context.
Definition at line 124 of file RenderTexture.cpp.
void galaxy::graphics::RenderTexture::clear | ( | ) |
Clear framebuffer attachments.
Definition at line 129 of file RenderTexture.cpp.
|
nodiscard |
Get texture width.
Is cached for performance.
Definition at line 134 of file RenderTexture.cpp.
|
nodiscard |
Get texture height.
Is cached for performance.
Definition at line 139 of file RenderTexture.cpp.
|
nodiscard |
Gets framebuffer texture.
Definition at line 144 of file RenderTexture.cpp.
|
nodiscard |
Get render texture projection.
Definition at line 149 of file RenderTexture.cpp.
|
nodiscard |
|
privatedelete |
Copy assignment operator.
|
private |
Cached width.
Definition at line 148 of file RenderTexture.hpp.
|
private |
Cached height.
Definition at line 153 of file RenderTexture.hpp.
|
private |
OpenGL framebuffer abstraction.
Definition at line 158 of file RenderTexture.hpp.
|
private |
Projection.
Definition at line 163 of file RenderTexture.hpp.