VolVis::Shader::ShaderManager Class Reference

#include <ShaderManager.h>


Detailed Description

This class is used for managing shader objects. A ShaderObject can be loaded from files, deleted, enabled or disabled. Additionally this class manages the CG profiles. All shader objects are stored in a list and deleted in the destructor of the shader manager.

See also:
ShaderObject


Public Member Functions

void disable () const
void enable (const ShaderObject *shader) const
ShaderObjectloadFromFile (std::string &vertexProgram, std::string &fragmentProgram)
void removeShader (ShaderObject *shader)
 ~ShaderManager ()

Static Public Member Functions

static void cgErrorCallback ()
static std::string getCombinedDir ()
static ShaderManagergetSingleton ()
static void setBasedir (std::string &basedir, std::string &shaderdir)


Constructor & Destructor Documentation

VolVis::Shader::ShaderManager::~ShaderManager (  ) 

Destructor. Deletes all shader object stored in the shader manager.


Member Function Documentation

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.

Parameters:
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.

Returns:
absolute path to the shader directory

static ShaderManager* VolVis::Shader::ShaderManager::getSingleton (  )  [static]

Returns the singleton instance of the shader manager.

Returns:
singleton

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.

Parameters:
vertexProgram path to the file containing the vertex program code
fragmentProgram path to the file containing the fragment program code
Returns:
the new created shader object. Its parameters can be defined directly over its object methods. You can enable/disable the shader object with the methods enable and disable of this shader manager.

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.

Parameters:
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.

Parameters:
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


The documentation for this class was generated from the following file:
Generated on Wed Dec 5 12:27:31 2007 for VolVis by  doxygen 1.5.1-p1