SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | List of all members
sgl::ShaderManager Class Reference

This class provides an class for managing shaders. More...

#include <manager_gl.hpp>

Inheritance diagram for sgl::ShaderManager:
sgl::Manager< Shader >

Public Member Functions

void remove (std::string name) override
 Removes and disposes a shader from the storage. More...
 
void clear () override
 Removes all shaders and disposes them. More...
 
ShaderloadShader (std::string path, std::string name, ShaderType type)
 Loads a shader from file and stores it. More...
 
ShaderProgramloadShaderProgram (std::string vertexPath, std::string fragmentPath, std::string vertexName, std::string fragmentName)
 Creates a shader program from a vertex shader file and a fragment shader file. More...
 
ShaderProgramcreateShaderProgram (std::string vertexName, std::string fragmentName)
 Creates a shader program from two stored shaders. More...
 
- Public Member Functions inherited from sgl::Manager< Shader >
 ~Manager (void)
 Deletes a manager and disposes all managed objects. More...
 
void put (std::string name, Shader *value)
 Stores a object with specified name. More...
 
Shaderget (std::string name)
 Gets a managed object from the storage. More...
 

Additional Inherited Members

- Protected Member Functions inherited from sgl::Manager< Shader >
 Manager (void)
 Initializes a new manager. More...
 
- Protected Attributes inherited from sgl::Manager< Shader >
std::map< std::string, Shader * > objects
 Contains the objects to manage. More...
 

Detailed Description

This class provides an class for managing shaders.

Definition at line 56 of file manager_gl.hpp.

Member Function Documentation

void sgl::ShaderManager::clear ( )
overridevirtual

Removes all shaders and disposes them.

Reimplemented from sgl::Manager< Shader >.

Definition at line 76 of file manager_gl.cpp.

ShaderProgram * sgl::ShaderManager::createShaderProgram ( std::string  vertexName,
std::string  fragmentName 
)

Creates a shader program from two stored shaders.

Parameters
vertexNameThe name of the stored vertex shader.
fragmentNameThe name of the stored fragment shader.
Returns
A shader program with the specified shaders.

Definition at line 139 of file manager_gl.cpp.

Shader * sgl::ShaderManager::loadShader ( std::string  path,
std::string  name,
ShaderType  type 
)

Loads a shader from file and stores it.

Parameters
pathFile path to the shader source.
nameThe name of the shader.
typeThe type of the shader, either VERTEX_SHADER or FRAGMENT_SHADER.
Returns
The loaded shader.

Definition at line 87 of file manager_gl.cpp.

ShaderProgram * sgl::ShaderManager::loadShaderProgram ( std::string  vertexPath,
std::string  fragmentPath,
std::string  vertexName,
std::string  fragmentName 
)

Creates a shader program from a vertex shader file and a fragment shader file.

Parameters
vertexPathFile path to the vertex shader source.
fragmentPathFile path to the fragment shader source.
vertexNameThe name for the vertex shader.
fragmentNameThe name for the fragment shader.
Returns
A shader program with the specified shader sources.

Definition at line 119 of file manager_gl.cpp.

void sgl::ShaderManager::remove ( std::string  name)
overridevirtual

Removes and disposes a shader from the storage.

Parameters
nameThe name of the shader.

Reimplemented from sgl::Manager< Shader >.

Definition at line 67 of file manager_gl.cpp.


The documentation for this class was generated from the following files: