Class for storing a shader.
More...
#include <Shader.hpp>
|
| enum class | Type { Vertex
, Fragment
, Geometry
} |
| |
|
|
MYGL_EXPORT | Shader () noexcept=default |
| | Creates an empty shader.
|
| |
| MYGL_EXPORT | Shader (const std::string &sourceCode, Type type) |
| | Creates a shader with a given type and its source code in a c string.
|
| |
| MYGL_EXPORT | ~Shader ()=default |
| | Destructor.
|
| |
| MYGL_EXPORT bool | loadFromFile (const std::string &filename, Type type) |
| | Loads a shader from a file.
|
| |
| MYGL_EXPORT bool | loadFromString (const std::string &sourceCode, Type type) |
| | Loads a shader from a string.
|
| |
| MYGL_EXPORT bool | isUsable () const noexcept |
| | Indicates if the shader is usable.
|
| |
Class for storing a shader.
Definition at line 14 of file Shader.hpp.
◆ Type
◆ Shader()
| MYGL_EXPORT Shader |
( |
const std::string & | sourceCode, |
|
|
Type | type ) |
Creates a shader with a given type and its source code in a c string.
- Parameters
-
| sourceCode | A string which holds the shader's source code |
| type | The shader's type (one of Vertex, Fragment and Geometry) |
◆ ~Shader()
Destructor.
The destructor deletes the underlying OpenGL shader object (it has no effect on Shader programs which have already linked this shader).
◆ isUsable()
| MYGL_EXPORT bool isUsable |
( |
| ) |
const |
|
noexcept |
Indicates if the shader is usable.
- Returns
- True if the shades is usable, false otherwise
◆ loadFromFile()
| MYGL_EXPORT bool loadFromFile |
( |
const std::string & | filename, |
|
|
Type | type ) |
Loads a shader from a file.
- Parameters
-
| filename | The name of the file containing the shader's source code |
| type | The shader's type (one of Vertex, Fragment and Geometry) |
- Returns
- True if the file was read succesfully and the shader was compiled without errors, false otherwise
◆ loadFromString()
| MYGL_EXPORT bool loadFromString |
( |
const std::string & | sourceCode, |
|
|
Type | type ) |
Loads a shader from a string.
- Parameters
-
| sourceCode | A string which holds the shader's source code |
| type | The shader's type (one of Vertex, Fragment and Geometry |
- Returns
- True if the shader was compiled without errors, false otherwise
◆ ShaderProgram
The documentation for this class was generated from the following file: