MyGL
|
Class for creating shader programs. More...
#include <ShaderProgram.hpp>
Public Member Functions | |||||||
MYGL_EXPORT | ShaderProgram () noexcept=default | ||||||
Creates an empty shader program, it is not usable as is. | |||||||
template<typename... Shaders> | |||||||
void | addShaders (Shader shader, Shaders... shaders) | ||||||
Adds one ore more shaders to this program. | |||||||
MYGL_EXPORT bool | link () | ||||||
Links all the added shaders to create a usable shader program. | |||||||
MYGL_EXPORT bool | isUsable () const noexcept | ||||||
Tells wether the shader program is usable. | |||||||
MYGL_EXPORT void | use () const | ||||||
Sets this program to be the active shader program. | |||||||
Uniform related functions | |||||||
These functions are used to modify a shader's uniform value, they take the uniform's name and the new value as parameters.
| |||||||
MYGL_EXPORT void | setMat4 (const std::string &name, const glm::mat4 &value) const | ||||||
Sets the value of a 4x4 matrix uniform. | |||||||
Int uniform functions | |||||||
MYGL_EXPORT void | setInt (const std::string &name, const glm::ivec1 &value) const | ||||||
Sets the value of an integer uniform. | |||||||
MYGL_EXPORT void | setInt (const std::string &name, const glm::ivec2 &value) const | ||||||
Sets the value of a 2 component integer vector (ivec2) uniform. | |||||||
MYGL_EXPORT void | setInt (const std::string &name, const glm::ivec3 &value) const | ||||||
Sets the value of a 3 component integer vector (ivec3) uniform. | |||||||
MYGL_EXPORT void | setInt (const std::string &name, const glm::ivec4 &value) const | ||||||
Sets the value of a 4 component integer vector (ivec4) uniform. | |||||||
template<typename... Args> | |||||||
void | setInt (const std::string &name, int v0, Args... values) const | ||||||
Sets the value of an integer uniform using multiple values. | |||||||
Unsigned int uniform functions | |||||||
MYGL_EXPORT void | setUInt (const std::string &name, const glm::uvec1 &value) const | ||||||
Sets the value of an unsigned integer uniform. | |||||||
MYGL_EXPORT void | setUInt (const std::string &name, const glm::uvec2 &value) const | ||||||
Sets the value of a 2 component unsigned integer vector (uvec2) uniform. | |||||||
MYGL_EXPORT void | setUInt (const std::string &name, const glm::uvec3 &value) const | ||||||
Sets the value of a 3 component unsigned integer vector (uvec3) uniform. | |||||||
MYGL_EXPORT void | setUInt (const std::string &name, const glm::uvec4 &value) const | ||||||
Sets the value of a 4 component unsigned integer vector (uvec4) uniform. | |||||||
template<typename... Args> | |||||||
void | setUInt (const std::string &name, unsigned int v0, Args... values) const | ||||||
Sets the value of an unsigned integer uniform using multiple values. | |||||||
Float uniform functions | |||||||
MYGL_EXPORT void | setFloat (const std::string &name, const glm::vec1 &value) const | ||||||
Sets the value of a float uniform. | |||||||
MYGL_EXPORT void | setFloat (const std::string &name, const glm::vec2 &value) const | ||||||
Sets the value of a 2 component float vector (vec2) uniform. | |||||||
MYGL_EXPORT void | setFloat (const std::string &name, const glm::vec3 &value) const | ||||||
Sets the value of a 3 component float vector (vec3) uniform. | |||||||
MYGL_EXPORT void | setFloat (const std::string &name, const glm::vec4 &value) const | ||||||
Sets the value of a 4 component float vector (vec4) uniform. | |||||||
template<typename... Args> | |||||||
void | setFloat (const std::string &name, float v0, Args... values) const | ||||||
Sets the value of a float uniform using multiple values. | |||||||
Friends | |
MYGL_EXPORT friend bool | operator== (const ShaderProgram &lhs, const ShaderProgram &rhs) noexcept |
MYGL_EXPORT friend bool | operator!= (const ShaderProgram &lhs, const ShaderProgram &rhs) noexcept |
Class for creating shader programs.
Definition at line 19 of file ShaderProgram.hpp.
|
inline |
Adds one ore more shaders to this program.
shader,shaders | The shaders to add to this program |
Definition at line 178 of file ShaderProgram.hpp.
|
noexcept |
Tells wether the shader program is usable.
MYGL_EXPORT bool link | ( | ) |
Links all the added shaders to create a usable shader program.
|
inline |
Sets the value of a float uniform using multiple values.
name | The uniform's name |
v0 | The first value |
values | The remaining values (up to 3) |
Definition at line 208 of file ShaderProgram.hpp.
|
inline |
Sets the value of an integer uniform using multiple values.
name | The uniform's name |
v0 | The first value |
values | The remaining values (up to 3) |
Definition at line 198 of file ShaderProgram.hpp.
|
inline |
Sets the value of an unsigned integer uniform using multiple values.
name | The uniform's name |
v0 | The first value |
values | The remaining values (up to 3) |
Definition at line 203 of file ShaderProgram.hpp.