SenOGL
0.2
Library aiming to ease the use of OpenGL
|
Base class for all types of shaders. More...
#include <Shader.hpp>
Public Member Functions | |
Shader ()=default | |
Default constructor. More... | |
virtual | ~Shader () |
Destructor. More... | |
virtual void | init () override |
Generates a OpenGL object name to manage. More... | |
virtual void | cleanup () override |
Deletes the managed OpenGL object. More... | |
void | loadFromFile (const std::string &path) |
Loads the source for this shader from the file at path. More... | |
void | reload () |
Reloads shader from file. More... | |
void | compile () |
Compiles this shader. More... | |
bool | isValid () const override |
Public Member Functions inherited from OpenGLObject | |
OpenGLObject () | |
OpenGLObject (GLuint handle) | |
Constructs a instance managing an existing OpenGL Object. More... | |
OpenGLObject (const OpenGLObject &)=default | |
OpenGLObject (OpenGLObject &&)=default | |
OpenGLObject & | operator= (const OpenGLObject &)=default |
OpenGLObject & | operator= (OpenGLObject &&)=default |
virtual | ~OpenGLObject () |
GLuint | getName () const |
Returns OpenGL name of the object. More... | |
void | setName (GLuint n) |
Sets the OpenGL name of the object managed by this instance /!\ Use with caution ! (assignment operator is probably what you're looking for) More... | |
operator bool () const | |
Syntactic sugar for isValid(). More... | |
Protected Member Functions | |
virtual GLenum | getType () const =0 |
Protected Attributes | |
std::string | _srcPath = "" |
Path to the last file read by loadFromFile. More... | |
bool | _compiled = false |
Says if the shader have already been successfully compiled. More... | |
Protected Attributes inherited from OpenGLObject | |
GLuint | _handle |
OpenGL name of the managed object. More... | |
Base class for all types of shaders.
|
default |
Default constructor.
|
virtual |
Destructor.
|
overridevirtual |
Deletes the managed OpenGL object.
Implements OpenGLObject.
void Shader::compile | ( | ) |
Compiles this shader.
Source for the shader must have been set before.
|
protectedpure virtual |
|
overridevirtual |
Generates a OpenGL object name to manage.
Implements OpenGLObject.
|
inlineoverridevirtual |
Reimplemented from OpenGLObject.
void Shader::loadFromFile | ( | const std::string & | path | ) |
Loads the source for this shader from the file at path.
path | Path to the file containing the source for the shader. |
void Shader::reload | ( | ) |
Reloads shader from file.
(Should be used only after a successfull call to loadFromFile).
|
protected |
Says if the shader have already been successfully compiled.
|
protected |
Path to the last file read by loadFromFile.