For managing shader programs.
More...
#include <sgct/shadermanager.h>
For managing shader programs.
Implemented as a singleton.
◆ ShaderManager() [1/2]
| sgct::ShaderManager::ShaderManager |
( |
const ShaderManager & | | ) |
|
|
delete |
◆ ShaderManager() [2/2]
| sgct::ShaderManager::ShaderManager |
( |
ShaderManager && | | ) |
|
|
delete |
◆ ~ShaderManager()
| sgct::ShaderManager::~ShaderManager |
( |
| ) |
|
Destructor deallocates and deletes all shaders.
◆ addShaderProgram()
| void sgct::ShaderManager::addShaderProgram |
( |
std::string | name, |
|
|
std::string_view | vertexSrc, |
|
|
std::string_view | fragmentSrc ) |
Adds shader programs to the manager.
The shaders will be compiled and linked to the program. The name of the shader needs to be unique or it won't be added and an exception is thrown. Both vertex shader and fragment shader source need to be provided, either as a link to a shader source code file or as shader source code.
- Parameters
-
| name | Unique name of the shader |
| vertexSrc | The vertex shader source code |
| fragmentSrc | The fragment shader source code |
- Exceptions
-
| std::runtime_error | If there was an error creating the shader program |
◆ destroy()
| void sgct::ShaderManager::destroy |
( |
| ) |
|
|
static |
◆ instance()
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ removeShaderProgram()
| bool sgct::ShaderManager::removeShaderProgram |
( |
std::string_view | name | ) |
|
Removes a shader program from the manager.
All resources allocated for the program will be deallocated and removed.
- Parameters
-
| name | Name of the shader program to remove |
- Returns
- true if the shader program was removed correctly
◆ shaderProgram()
| const ShaderProgram & sgct::ShaderManager::shaderProgram |
( |
std::string_view | name | ) |
const |
Get the specified shader program from the shader manager.
- Parameters
-
| name | Name of the shader program |
- Returns
- The specified shader program
- Exceptions
-
| std::runtime_error | If the shader program with the name was not found |
◆ shaderProgramExists()
| bool sgct::ShaderManager::shaderProgramExists |
( |
std::string_view | name | ) |
const |
Check if a shader program exists in the manager.
- Parameters
-
| name | Name of the shader program |
The documentation for this class was generated from the following file: