|
Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
|
A wrapper over OpenGL's shader programs. More...
#include <shader_program.hpp>
Public Member Functions | |
| ShaderProgram (GLuint program) | |
| Constructs a new shader program out of an OpenGL shader program already present in memory. | |
| ~ShaderProgram () | |
| Shader destructor; deletes shader from memory. | |
| ShaderProgram (const ShaderProgram &other)=delete | |
| ShaderProgram & | operator= (const ShaderProgram &other)=delete |
| ShaderProgram (ShaderProgram &&other) noexcept | |
| Shader move constructor. | |
| ShaderProgram & | operator= (ShaderProgram &&other) noexcept |
| Shader move assignment. | |
| void | use () const |
| Makes this shader the active one in this program's OpenGL context. | |
| GLint | getLocationAttribArray (const std::string &name) const |
| Retrieves the location (ID) of an attrib array with a given name. | |
| void | enableAttribArray (const std::string &name) const |
| Enables an attrib array with a given name. | |
| void | enableAttribArray (GLint locationAttrib) const |
| Enables an attrib array with a given ID. | |
| void | disableAttribArray (const std::string &name) const |
| Disables an attrib array with a given name. | |
| void | disableAttribArray (GLint locationAttrib) const |
| Disables an attrib array with a given ID. | |
| GLint | getLocationUniform (const std::string &name) const |
| Gets the location (ID) of a uniform with a given name. | |
| void | setUBool (const std::string &name, bool value) const |
| Sets a uniform boolean value. | |
| void | setUInt (const std::string &name, int value) const |
| Sets an int uniform's value. | |
| void | setUFloat (const std::string &name, float value) const |
| Sets a float uniform's value. | |
| void | setUVec2 (const std::string &name, const glm::vec2 &value) const |
| Sets a vec2 uniform's value. | |
| void | setUVec3 (const std::string &name, const glm::vec3 &value) const |
| Sets a vec3 uniform's value. | |
| void | setUVec4 (const std::string &name, const glm::vec4 &value) const |
| Sets a vec4 uniform's value. | |
| void | setUMat4 (const std::string &name, const glm::mat4 &value) const |
| Sets a mat4 uniform's value. | |
| GLint | getLocationUniformBlock (const std::string &name) const |
| Gets the ID of one of this shader's uniform blocks with a certain name. | |
| void | setUniformBlock (const std::string &name, GLuint bindingPoint) const |
| Binds this shader's named uniform block to a specific uniform binding point. | |
| GLuint | getProgramID () const |
| Returns the ID of the OpenGL shader program this class is a wrapper over. | |
Public Member Functions inherited from ToyMaker::Resource< ShaderProgram > | |
| std::string | getResourceTypeName_ () const override |
| Get the resource type string for this resource. | |
Public Member Functions inherited from ToyMaker::IResource | |
| virtual | ~IResource ()=default |
| Destroy the IResource object. | |
Static Public Member Functions | |
| static std::string | getResourceTypeName () |
| The resource type string associated with this class. | |
Private Attributes | |
| GLuint | mID |
| The ID of the shader program this object is a wrapper over. | |
Additional Inherited Members | |
Protected Member Functions inherited from ToyMaker::Resource< ShaderProgram > | |
| Resource (int explicitlyInitializeMe) | |
| Construct a new resource object. | |
Protected Member Functions inherited from ToyMaker::IResource | |
| IResource ()=default | |
| Construct a new IResource object. | |
Static Protected Member Functions inherited from ToyMaker::IResource | |
| template<typename TResource> | |
| static void | RegisterResource () |
| Registers this resource as a Resource type with the ResourceDatabase. | |
A wrapper over OpenGL's shader programs.
| ShaderProgram::ShaderProgram | ( | GLuint | program | ) |
Constructs a new shader program out of an OpenGL shader program already present in memory.
| program | The ID of the OpenGL program. |
| void ShaderProgram::disableAttribArray | ( | const std::string & | name | ) | const |
Disables an attrib array with a given name.
| name | The name of the attrib array being disabled. |
| void ShaderProgram::disableAttribArray | ( | GLint | locationAttrib | ) | const |
Disables an attrib array with a given ID.
| locationAttrib | The ID of the attrib array being disabled. |
| void ShaderProgram::enableAttribArray | ( | const std::string & | name | ) | const |
Enables an attrib array with a given name.
| name | The name of the array being enabled. |
| void ShaderProgram::enableAttribArray | ( | GLint | locationAttrib | ) | const |
Enables an attrib array with a given ID.
| locationAttrib | The ID of the array being enabled. |
| GLint ShaderProgram::getLocationAttribArray | ( | const std::string & | name | ) | const |
Retrieves the location (ID) of an attrib array with a given name.
| name | The name of the attrib array. |
| GLint ShaderProgram::getLocationUniform | ( | const std::string & | name | ) | const |
Gets the location (ID) of a uniform with a given name.
| name | The name of the uniform location being retrieved. |
| GLint ShaderProgram::getLocationUniformBlock | ( | const std::string & | name | ) | const |
Gets the ID of one of this shader's uniform blocks with a certain name.
This ID can then be set to a UBO binding point, which lets the program find the associated uniform buffer.
| name | The name of this shader's uniform block. |
| GLuint ShaderProgram::getProgramID | ( | ) | const |
Returns the ID of the OpenGL shader program this class is a wrapper over.
|
inlinestatic |
The resource type string associated with this class.
| void ShaderProgram::setUBool | ( | const std::string & | name, |
| bool | value ) const |
Sets a uniform boolean value.
| name | The name of the boolean uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUFloat | ( | const std::string & | name, |
| float | value ) const |
Sets a float uniform's value.
| name | The name of the float uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUInt | ( | const std::string & | name, |
| int | value ) const |
Sets an int uniform's value.
| name | The name of the int uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUMat4 | ( | const std::string & | name, |
| const glm::mat4 & | value ) const |
Sets a mat4 uniform's value.
| name | The name of the mat4 uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUniformBlock | ( | const std::string & | name, |
| GLuint | bindingPoint ) const |
Binds this shader's named uniform block to a specific uniform binding point.
The binding point lets the shader program find the uniform buffer associated with the binding point via the uniform variable naming the uniform block.
| name | The name of the uniform block. |
| bindingPoint | The uniform binding point the block should be bound to. |
| void ShaderProgram::setUVec2 | ( | const std::string & | name, |
| const glm::vec2 & | value ) const |
Sets a vec2 uniform's value.
| name | The name of the vec2 uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUVec3 | ( | const std::string & | name, |
| const glm::vec3 & | value ) const |
Sets a vec3 uniform's value.
| name | The name of the vec3 uniform. |
| value | The value of the uniform. |
| void ShaderProgram::setUVec4 | ( | const std::string & | name, |
| const glm::vec4 & | value ) const |
Sets a vec4 uniform's value.
| name | The name of the vec4 uniform. |
| value | The value of the uniform. |