A class to represent an OpenGL shader (vertex, fragment, etc.). More...
#include <shader.hpp>
Public Member Functions | |
Shader ()=default | |
Default constructor for Shader. | |
~Shader () | |
Destructor for Shader. | |
MOVABLE_BUT_NOT_COPYABLE (Shader) | |
Move constructor for Shader. | |
bool | loadFromFile (const std::string &filePath, GLenum shaderType) |
Loads a shader from a file. | |
bool | loadFromSource (const std::string &sourceCode, GLenum shaderType) |
Loads a shader from source code. | |
GLuint | getID () const |
Gets the OpenGL shader ID. | |
const std::string & | getLastError () const |
Gets the last error message. | |
A class to represent an OpenGL shader (vertex, fragment, etc.).
This class provides functionality to load, compile, and manage OpenGL shader objects. It allows for loading shaders from source code or files, compiling them, and retrieving error information in case of compilation failures.
Definition at line 43 of file shader.hpp.
Raftel::Shader::~Shader | ( | ) |
Destructor for Shader.
Deletes the shader if it was created successfully.
|
inline |
|
inline |
bool Raftel::Shader::loadFromFile | ( | const std::string & | filePath, |
GLenum | shaderType ) |
Loads a shader from a file.
filePath | The path to the shader file. |
shaderType | The type of shader (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc.). |
bool Raftel::Shader::loadFromSource | ( | const std::string & | sourceCode, |
GLenum | shaderType ) |
Loads a shader from source code.
sourceCode | The source code of the shader. |
shaderType | The type of shader (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc.). |
Raftel::Shader::MOVABLE_BUT_NOT_COPYABLE | ( | Shader | ) |