NGL
6.5
The NCCA Graphics Library
|
Singleton Class to init and Use GLSL Shaders the class stores the shaders as a map of shader objects and they can be found by name Updated to use templated singleton Updated to use a map to store the shaders by name and hence removed the name from the ShaderObject Class Also Added methods to adjust shader parameters by shader / param name, at present use only 1-4 Floats and a few others need to think of a better way of doing this. More...
#include <ShaderLib.h>
Public Member Functions | |
void | createShaderProgram (const std::string &_name) noexcept |
create an empty ShaderProgram for us to attach shaders etc to More... | |
void | attachShader (const std::string &_name, ShaderType _type) noexcept |
attatch a Shader to the ShaderProgram referenced by _name More... | |
void | attachShaderToProgram (const std::string &_program, const std::string &_shader) noexcept |
attatch a Shader to the ShaderProgram referenced by _name More... | |
GLuint | getProgramID (const std::string &_name) noexcept |
get the Program ID of the GL Program by name More... | |
void | compileShader (const std::string &_name) noexcept |
compile the shader from _name More... | |
void | linkProgramObject (const std::string &_name) noexcept |
link the program Object from _name More... | |
void | toggleDebug () noexcept |
toggle debug mode More... | |
void | use (const std::string &_name) noexcept |
set active shader to name (if not found sets glProgramObject(0) More... | |
void | bindAttribute (const std::string &_programName, GLuint _index, const std::string &_attribName) noexcept |
bind an attribute at index by name More... | |
void | bindFragDataLocation (const std::string &_programName, GLuint _index, const std::string &_attribName) noexcept |
fragment shader output location More... | |
ShaderProgram * | operator[] (const std::string &_name) noexcept |
accessor to the shader program using the subscript operatoir More... | |
ShaderProgram * | operator[] (const char *_name) noexcept |
accessor to the shader program using the subscript operatoir More... | |
void | loadShader (const std::string &_shaderName, const std::string &_vert, const std::string &_frag, const std::string &_geo="", const bool _exitOnError=false) noexcept |
method to load shaders More... | |
bool | loadFromJson (const std::string &_fname) noexcept |
method to load multiple shaders from a json file More... | |
void | debugOn () noexcept |
Toggle debug mode on. More... | |
void | debugOff () noexcept |
Toggle debug mode off. More... | |
size_t | getNumShaders () const noexcept |
get the number of shaders stored More... | |
void | setShaderParamFromMat4 (const std::string &_paramName, Mat4 _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniformFromMat4 (const std::string &_registeredUniformName, Mat4 _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setShaderParamFromMat3 (const std::string &_paramName, Mat3 _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniformFromMat3 (const std::string &_paramName, Mat3 _p1) noexcept |
set the registered uniform from Max3x3 More... | |
void | setShaderParamFromVec4 (const std::string &_paramName, Vec4 _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniformVec4 (const std::string &_paramName, Vec4 _p1) noexcept |
set the pre-registered uniform from an Vec4 More... | |
void | setShaderParamFromColour (const std::string &_paramName, Colour _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniformFromColour (const std::string &_paramName, Colour _p1) noexcept |
set the pre-registered uniform from an Colour More... | |
void | setRegisteredUniformVec3 (const std::string &_paramName, Vec3 _p1) noexcept |
set the pre-registered uniform from an Vector More... | |
void | setRegisteredUniformVec2 (const std::string &_paramName, Vec2 _p1) noexcept |
set the pre-registered uniform from a Vector More... | |
void | setShaderParam1i (const std::string &_paramName, int _p1) noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform1i (const std::string &_paramName, int _p1) noexcept |
set the pre-registered uniform More... | |
void | setShaderParam1f (const std::string &_paramName, float _p1) noexcept |
set a shader param by name for 1 float param note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform1f (const std::string &_paramName, float _p1) noexcept |
set the pre-registered uniform More... | |
void | setShaderParam2f (const std::string &_paramName, float _p1, float _p2) noexcept |
set a shader param by name for 2 float params note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform2f (const std::string &_paramName, float _p1, float _p2) noexcept |
set the pre-registered uniform More... | |
void | setShaderParam3f (const std::string &_paramName, float _p1, float _p2, float _p3) noexcept |
set a shader param by name for 3 float params note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform3f (const std::string &_paramName, float _p1, float _p2, float _p3) noexcept |
set the pre-registered uniform More... | |
void | setShaderParam4f (const std::string &_paramName, float _p1, float _p2, float _p3, float _p4) noexcept |
set a shader param by name for 4 float params note that the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform4f (const std::string &_paramName, float _p1, float _p2, float _p3, float _p4) noexcept |
set the pre-registered uniform More... | |
void | printProperties () const noexcept |
print the properties of the currently active shader More... | |
void | reset () noexcept |
reset the Shader manager which will delete all shader objects More... | |
GLint | getAttribLocation (const std::string &_shaderName, const std::string &_paramName) noexcept |
return the index to the shader attribute location More... | |
void | loadShaderSource (std::string _shaderName, std::string _sourceFile) noexcept |
Load shader source from text file the path will be relative from current dir unless a full path is specified. More... | |
void | loadShaderSourceFromString (const std::string &_shaderName, const std::string &_string) noexcept |
load shader from a C string, useful for including code in headers etc More... | |
void | useNullProgram () noexcept |
use the null program (this will turn off any shaders), if using some drivers this will go to the fixed function pipeline More... | |
GLuint | getUniformBlockIndex (const std::string &_uniformBlockName) const noexcept |
grab the index of the unifrom block, this may not be supported on all GPU's More... | |
void | registerUniform (const std::string &_shaderName, const std::string &_uniformName) noexcept |
register a uniform so we don't have to call glGet functions when using More... | |
void | autoRegisterUniforms (const std::string &_shaderName) noexcept |
will parse the shader source and find any uniforms it can and register them More... | |
void | printRegisteredUniforms (const std::string &_shader) const noexcept |
debug print any registered uniforms More... | |
void | setUniform (const std::string &_paramName, Real _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Real _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Real _v0, Real _v1) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Real _v0, Real _v1) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Real _v0, Real _v1, Real _v2) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Real _v0, Real _v1, Real _v2) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Real _v0, Real _v1, Real _v2, Real _v3) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Real _v0, Real _v1, Real _v2, Real _v3) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, GLint _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, GLint _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, GLint _v0, GLint _v1) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, GLint _v0, GLint _v1) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, GLint _v0, GLint _v1, GLint _v2) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, GLint _v0, GLint _v1, GLint _v2) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, GLint _v0, GLint _v1, GLint _v2, GLint _v3) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, GLint _v0, GLint _v1, GLint _v2, GLint _v3) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Colour _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Colour _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Vec2 _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Vec2 _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Vec3 _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Vec3 _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Vec4 _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Vec4 _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Mat3 _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Mat3 _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
void | setUniform (const std::string &_paramName, Mat4 _v0) noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail More... | |
void | setRegisteredUniform (const std::string &_paramName, Mat4 _v0) noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail More... | |
GLuint | getShaderID (const std::string &_shaderName) noexcept |
method to return a shader ID More... | |
ngl::Shader * | getShader (const std::string &_shaderName) noexcept |
method to return the specified shader object More... | |
Public Member Functions inherited from ngl::Singleton< ShaderLib > | |
Singleton (const Singleton &)=delete | |
Singleton & | operator= (const Singleton &)=delete |
Protected Member Functions | |
ShaderType | getShaderType (const std::string &type) noexcept |
get shader type from string (used for json parsing) More... | |
void | loadTextShaders () noexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/TextShaders.h More... | |
void | loadColourShaders () noexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/ColourShaders.h More... | |
void | loadDiffuseShaders () noexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/DiffuseShaders.h More... | |
void | loadToonShaders () noexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/ToonShaders.h More... | |
ShaderLib () noexcept | |
default ctor private as a singleton More... | |
virtual | ~ShaderLib () |
default ctor private as a singleton More... | |
ShaderLib (const ShaderLib &)=delete | |
copy ctor private as singleton More... | |
Protected Member Functions inherited from ngl::Singleton< ShaderLib > | |
Singleton () | |
Constructor. More... | |
virtual | ~Singleton () |
Destructor. More... | |
Protected Attributes | |
std::unordered_map< std::string, ShaderProgram * > | m_shaderPrograms |
a map of shader Programs using name as key to shader pointer More... | |
std::unordered_map< std::string, Shader * > | m_shaders |
map of shaders using name as key More... | |
ShaderProgram * | m_nullProgram |
null ShaderProgram so we can return when shader not know; More... | |
std::string | m_currentShader |
the name of the currently active shader More... | |
bool | m_debugState |
flag to indicate the debug state More... | |
unsigned int | m_numShaders |
the nunmber of shaders loaded More... | |
Friends | |
class | Singleton< ShaderLib > |
Additional Inherited Members | |
Static Public Member Functions inherited from ngl::Singleton< ShaderLib > | |
static ShaderLib * | instance () |
Get the instance. More... | |
Static Protected Member Functions inherited from ngl::Singleton< ShaderLib > | |
static void | killSingleton () |
Static Protected Attributes inherited from ngl::Singleton< ShaderLib > | |
static ShaderLib * | s_instance |
unique instance of the singleton More... | |
Singleton Class to init and Use GLSL Shaders the class stores the shaders as a map of shader objects and they can be found by name Updated to use templated singleton Updated to use a map to store the shaders by name and hence removed the name from the ShaderObject Class Also Added methods to adjust shader parameters by shader / param name, at present use only 1-4 Floats and a few others need to think of a better way of doing this.
Definition at line 55 of file ShaderLib.h.
|
protectednoexcept |
default ctor private as a singleton
Definition at line 231 of file ShaderLib.cpp.
References loadColourShaders(), loadDiffuseShaders(), loadTextShaders(), loadToonShaders(), m_currentShader, m_debugState, m_nullProgram, m_numShaders, and m_shaderPrograms.
|
inlineprotectedvirtual |
default ctor private as a singleton
Definition at line 668 of file ShaderLib.h.
|
protecteddelete |
copy ctor private as singleton
|
noexcept |
attatch a Shader to the ShaderProgram referenced by _name
_name | the name of the ShaderProgram to attach |
Definition at line 279 of file ShaderLib.cpp.
References m_debugState, and m_shaders.
|
noexcept |
attatch a Shader to the ShaderProgram referenced by _name
_program | the name of the ShaderProgram to attach to |
_shader | the name of the Shader to attach to Program |
Definition at line 308 of file ShaderLib.cpp.
References m_debugState, m_shaderPrograms, and m_shaders.
|
noexcept |
will parse the shader source and find any uniforms it can and register them
[in] | _shaderName | the name of the shader to set the param for |
Definition at line 544 of file ShaderLib.cpp.
References m_shaderPrograms.
|
noexcept |
bind an attribute at index by name
_programName | the name of the ShaderProgram to use |
_index | the attribute index to bind |
_attribName | the name of the attribute in the shader to be bound to this index |
Definition at line 559 of file ShaderLib.cpp.
References m_shaderPrograms.
|
noexcept |
fragment shader output location
_programName | the name of the ShaderProgram to use |
_index | the attribute index to bind |
_attribName | the name of the attribute in the shader to be bound to this index |
Definition at line 572 of file ShaderLib.cpp.
References m_shaderPrograms.
|
noexcept |
compile the shader from _name
_name | the name of the ShaderProgram to compile |
Definition at line 287 of file ShaderLib.cpp.
References m_shaders.
|
noexcept |
create an empty ShaderProgram for us to attach shaders etc to
_name | the name of the ShaderProgram to link |
Definition at line 301 of file ShaderLib.cpp.
References m_debugState, and m_shaderPrograms.
|
inlinenoexcept |
Toggle debug mode off.
Definition at line 156 of file ShaderLib.h.
|
inlinenoexcept |
Toggle debug mode on.
Definition at line 152 of file ShaderLib.h.
|
noexcept |
return the index to the shader attribute location
_shaderName | the name of the shader program |
_paramName | the name of the parameter to find |
Definition at line 206 of file ShaderLib.cpp.
References glGetAttribLocation, and m_shaderPrograms.
|
inlinenoexcept |
get the number of shaders stored
Definition at line 161 of file ShaderLib.h.
|
noexcept |
get the Program ID of the GL Program by name
_name | the name of the ShaderProgram to find |
Definition at line 528 of file ShaderLib.cpp.
References m_shaderPrograms.
|
noexcept |
method to return the specified shader object
_shaderName | the name of the shader to return |
Definition at line 262 of file ShaderLib.cpp.
References m_currentShader, and m_shaders.
|
noexcept |
method to return a shader ID
_shaderName | the name of the shader who's ID to return |
Definition at line 246 of file ShaderLib.cpp.
References m_currentShader, and m_shaders.
|
protectednoexcept |
get shader type from string (used for json parsing)
Definition at line 345 of file ShaderLib.cpp.
References ngl::COMPUTE, ngl::FRAGMENT, ngl::GEOMETRY, ngl::NONE, ngl::TESSCONTROL, ngl::TESSEVAL, and ngl::VERTEX.
|
noexcept |
grab the index of the unifrom block, this may not be supported on all GPU's
_uniformBlockName | the name of the block to get the index for |
Definition at line 639 of file ShaderLib.cpp.
References m_currentShader, and m_shaderPrograms.
|
noexcept |
link the program Object from _name
_name | the name of the ShaderProgram to link |
Definition at line 492 of file ShaderLib.cpp.
References m_shaderPrograms.
|
protectednoexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/ColourShaders.h
Definition at line 689 of file ShaderLib.cpp.
References attachShader(), attachShaderToProgram(), autoRegisterUniforms(), bindAttribute(), colourFragmentShader, colourVertexShader, compileShader(), createShaderProgram(), ngl::FRAGMENT, linkProgramObject(), loadShaderSourceFromString(), use(), and ngl::VERTEX.
|
protectednoexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/DiffuseShaders.h
Definition at line 715 of file ShaderLib.cpp.
References attachShader(), attachShaderToProgram(), autoRegisterUniforms(), bindAttribute(), compileShader(), createShaderProgram(), diffuseFragmentShader, diffuseVertexShader, ngl::FRAGMENT, linkProgramObject(), loadShaderSourceFromString(), use(), and ngl::VERTEX.
|
noexcept |
method to load multiple shaders from a json file
[in] | _shaderName | the name of the json resource file |
Definition at line 372 of file ShaderLib.cpp.
References attachShader(), attachShaderToProgram(), compileShader(), createShaderProgram(), getShaderType(), linkProgramObject(), loadShaderSourceFromString(), and SizeType.
|
noexcept |
method to load shaders
[in] | _shaderName | the name of the shader to be stored in the Manager |
[in] | _vert | the vertex shader to load |
[in] | _frag | the fragment shader to load |
[in] | _geo | an optional geo shader to load |
[in] | _exitOnError | exit if there is an error in the shader |
Definition at line 167 of file ShaderLib.cpp.
References ngl::FRAGMENT, ngl::GEOMETRY, NGL_UNUSED, and ngl::VERTEX.
|
noexcept |
Load shader source from text file the path will be relative from current dir unless a full path is specified.
_shaderName | the name of the shader program |
_sourceFile | the path of the file to load |
Definition at line 332 of file ShaderLib.cpp.
References m_shaders.
|
noexcept |
load shader from a C string, useful for including code in headers etc
_shaderName | the name of the shader program |
_string | the text array of shader data |
Definition at line 477 of file ShaderLib.cpp.
References m_shaders.
|
protectednoexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/TextShaders.h
Definition at line 660 of file ShaderLib.cpp.
References attachShader(), attachShaderToProgram(), autoRegisterUniforms(), bindAttribute(), compileShader(), createShaderProgram(), ngl::FRAGMENT, linkProgramObject(), loadShaderSourceFromString(), textFragmentShader, textVertexShader, use(), and ngl::VERTEX.
|
protectednoexcept |
this will load the pre-defined text rendering shaders these are stored in the file src/shaders/ToonShaders.h
Definition at line 743 of file ShaderLib.cpp.
References attachShader(), attachShaderToProgram(), autoRegisterUniforms(), bindAttribute(), compileShader(), createShaderProgram(), ngl::FRAGMENT, linkProgramObject(), loadShaderSourceFromString(), toonFragmentShader, toonVertexShader, use(), and ngl::VERTEX.
|
noexcept |
accessor to the shader program using the subscript operatoir
_name | the name of the ShaderProgram to use |
Definition at line 594 of file ShaderLib.cpp.
References m_currentShader, m_nullProgram, and m_shaderPrograms.
|
noexcept |
accessor to the shader program using the subscript operatoir
_name | the name of the ShaderProgram to use |
Definition at line 613 of file ShaderLib.cpp.
References m_currentShader, m_nullProgram, and m_shaderPrograms.
|
noexcept |
print the properties of the currently active shader
Definition at line 781 of file ShaderLib.cpp.
References m_currentShader, and m_shaderPrograms.
|
noexcept |
debug print any registered uniforms
Definition at line 771 of file ShaderLib.cpp.
References m_shaderPrograms.
|
noexcept |
register a uniform so we don't have to call glGet functions when using
[in] | _shaderName | the name of the shader to set the param for |
[in] | _uniformName | the name of the uniform to register |
|
noexcept |
reset the Shader manager which will delete all shader objects
Definition at line 195 of file ShaderLib.cpp.
References m_shaderPrograms, and m_shaders.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
Definition at line 806 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
Definition at line 816 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
[in] | _v2 | the float value of the parameter to set |
Definition at line 827 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
[in] | _v2 | the float value of the parameter to set |
[in] | _v3 | the float value of the parameter to set |
Definition at line 836 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
Definition at line 845 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
Definition at line 854 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
[in] | _v2 | the int value of the parameter to set |
Definition at line 863 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
[in] | _v2 | the int value of the parameter to set |
[in] | _v3 | the int value of the parameter to set |
Definition at line 872 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Colour value of the parameter to set |
Definition at line 881 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec2 value of the parameter to set |
Definition at line 889 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec3 value of the parameter to set |
Definition at line 897 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec4 value of the parameter to set |
Definition at line 905 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Mat3 value of the parameter to set |
Definition at line 915 of file ShaderLib.cpp.
References GL_FALSE, and m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms that have been pre-registered using auto-register uniforms method must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Mat4 value of the parameter to set |
Definition at line 925 of file ShaderLib.cpp.
References GL_FALSE, and m_currentShader.
|
noexcept |
set the pre-registered uniform
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
Definition at line 160 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
Definition at line 145 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
Definition at line 133 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
[in] | _p3 | the float value of the parameter to set |
Definition at line 120 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
[in] | _p3 | the float value of the parameter to set |
Definition at line 108 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform from an Colour
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from |
Definition at line 82 of file ShaderLib.cpp.
|
noexcept |
set the registered uniform from Max3x3
[in] | _uniformName | the name of the uniform in the shader to set |
[in] | _p1 | the matrix to set from (float 16) value of the parameter to set |
Definition at line 57 of file ShaderLib.cpp.
References GL_FALSE.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _registeredUniformName | the name of the registered uniform in the shader to set |
[in] | _p1 | the matrix to set from (float 16) value of the parameter to set |
Definition at line 45 of file ShaderLib.cpp.
References GL_FALSE.
|
noexcept |
set the pre-registered uniform from a Vector
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from |
Definition at line 93 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform from an Vector
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from |
Definition at line 87 of file ShaderLib.cpp.
|
noexcept |
set the pre-registered uniform from an Vec4
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from |
Definition at line 69 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 1 float param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
Definition at line 153 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
Definition at line 138 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 2 float params note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
Definition at line 126 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 3 float params note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
[in] | _p3 | the float value of the parameter to set |
Definition at line 114 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 4 float params note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the float value of the parameter to set |
[in] | _p2 | the float value of the parameter to set |
[in] | _p3 | the float value of the parameter to set |
[in] | _p4 | the float value of the parameter to set |
Definition at line 102 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from (float 4) value of the parameter to set |
Definition at line 75 of file ShaderLib.cpp.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the matrix to set from (float 16) value of the parameter to set |
Definition at line 51 of file ShaderLib.cpp.
References GL_FALSE.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the matrix to set from (float 16) value of the parameter to set |
Definition at line 39 of file ShaderLib.cpp.
References GL_FALSE.
|
noexcept |
set a shader param by name for 1 int param note that the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the parameter in the shader to set |
[in] | _p1 | the vector to set from (float 4) value of the parameter to set |
Definition at line 62 of file ShaderLib.cpp.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
Definition at line 802 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
Definition at line 812 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
[in] | _v2 | the float value of the parameter to set |
Definition at line 822 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the float value of the parameter to set |
[in] | _v1 | the float value of the parameter to set |
[in] | _v2 | the float value of the parameter to set |
[in] | _v3 | the float value of the parameter to set |
Definition at line 832 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
Definition at line 841 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
Definition at line 850 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
[in] | _v2 | the int value of the parameter to set |
Definition at line 859 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the int value of the parameter to set |
[in] | _v1 | the int value of the parameter to set |
[in] | _v2 | the int value of the parameter to set |
[in] | _v3 | the int value of the parameter to set |
Definition at line 868 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the colour value of the parameter to set |
Definition at line 877 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec3 value of the parameter to set |
Definition at line 885 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec3 value of the parameter to set |
Definition at line 893 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Vec4 value of the parameter to set |
Definition at line 901 of file ShaderLib.cpp.
References m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Mat3 value of the parameter to set |
Definition at line 910 of file ShaderLib.cpp.
References GL_FALSE, and m_currentShader.
|
noexcept |
overloaded method to set shader Uniforms the shader must be the currently active shader of else this will fail
[in] | _paramName | the name of the Uniform to set |
[in] | _v0 | the Mat4 value of the parameter to set |
Definition at line 921 of file ShaderLib.cpp.
References GL_FALSE, and m_currentShader.
|
inlinenoexcept |
toggle debug mode
Definition at line 98 of file ShaderLib.h.
|
noexcept |
set active shader to name (if not found sets glProgramObject(0)
_name | the name of the ShaderProgram to use |
Definition at line 507 of file ShaderLib.cpp.
References glUseProgram, m_currentShader, and m_shaderPrograms.
|
noexcept |
use the null program (this will turn off any shaders), if using some drivers this will go to the fixed function pipeline
Definition at line 632 of file ShaderLib.cpp.
References m_currentShader, m_nullProgram, and ngl::ShaderProgram::use().
Definition at line 57 of file ShaderLib.h.
|
protected |
the name of the currently active shader
Definition at line 652 of file ShaderLib.h.
|
protected |
flag to indicate the debug state
Definition at line 656 of file ShaderLib.h.
|
protected |
null ShaderProgram so we can return when shader not know;
Definition at line 648 of file ShaderLib.h.
|
protected |
the nunmber of shaders loaded
Definition at line 660 of file ShaderLib.h.
|
protected |
a map of shader Programs using name as key to shader pointer
Definition at line 640 of file ShaderLib.h.
|
protected |
map of shaders using name as key
Definition at line 644 of file ShaderLib.h.