#include <ShaderManager.h>
Public Member Functions | |
void | disable () const |
void | enable (const ShaderObject *shader) const |
ShaderObject * | loadFromFile (std::string &vertexProgram, std::string &fragmentProgram) |
void | removeShader (ShaderObject *shader) |
~ShaderManager () | |
Static Public Member Functions | |
static void | cgErrorCallback () |
static std::string | getCombinedDir () |
static ShaderManager * | getSingleton () |
static void | setBasedir (std::string &basedir, std::string &shaderdir) |
VolVis::Shader::ShaderManager::~ShaderManager | ( | ) |
Destructor. Deletes all shader object stored in the shader manager.
static void VolVis::Shader::ShaderManager::cgErrorCallback | ( | ) | [static] |
This callback method is called when a cg error occurs.
void VolVis::Shader::ShaderManager::disable | ( | ) | const |
This method disabled the cg profiles.
void VolVis::Shader::ShaderManager::enable | ( | const ShaderObject * | shader | ) | const |
This method enables the cg profiles and the passed shader object. The shader object is used until another shader object is enabled or all shaders are disabled. The shader object contains a vertex and fragment program.
shader | shader object which should be used for rendering |
static std::string VolVis::Shader::ShaderManager::getCombinedDir | ( | ) | [static] |
This returns the combined path of the basedir and shaderdir (defined with the method setBaseDir) which is the absolute path to the directory where the shader files are located.
static ShaderManager* VolVis::Shader::ShaderManager::getSingleton | ( | ) | [static] |
Returns the singleton instance of the shader manager.
ShaderObject* VolVis::Shader::ShaderManager::loadFromFile | ( | std::string & | vertexProgram, | |
std::string & | fragmentProgram | |||
) |
Creates a new shader object containing the programs defined in the specified files. The new shader object is managed in this class and deleted in the destructor. Alternatively it can be deleted with the method removeShader.
vertexProgram | path to the file containing the vertex program code | |
fragmentProgram | path to the file containing the fragment program code |
void VolVis::Shader::ShaderManager::removeShader | ( | ShaderObject * | shader | ) |
If a shader won't be used anymore in the application it can be removed from the shader list stored in this shader manager. The shader object will also be deleted in memory.
shader | the shader object which should be deleted |
static void VolVis::Shader::ShaderManager::setBasedir | ( | std::string & | basedir, | |
std::string & | shaderdir | |||
) | [static] |
The basedir is needed to set up the correct paths for the shaders.
basedir | the complete path to the directory containing the current exe-file. | |
shaderdir | relative path from the current basedir to the directory where the shader files are located |