Provides a C++ interface to the OpenGL shader program construct.
More...
#include <ShaderProgram.h>
|
| | ShaderProgram () |
| |
| | ~ShaderProgram () |
| |
| int | Link () |
| |
| void | Bind () |
| |
| bool | IsBound () const |
| |
| void | AddShader (Shader *s) |
| |
| int | AddShaderFromSource (unsigned int type, const char *source) |
| |
| unsigned int | GetID () const |
| |
| unsigned int | WasLinkingSuccessful () const |
| |
| int | GetAttributeLocation (const std::string &name) const |
| |
| int | GetUniformLocation (const std::string &name) const |
| |
| bool | HasUniform (const std::string &name) const |
| |
| void | ComputeSamplerLocations () |
| |
| template<typename T > |
| bool | SetUniform (const std::string &name, const T &value) const |
| |
| void | SetUniform (int location, const int &value) const |
| |
| void | SetUniform (int location, const float &value) const |
| |
| void | SetUniform (int location, const glm::vec2 &value) const |
| |
| void | SetUniform (int location, const glm::vec3 &value) const |
| |
| void | SetUniform (int location, const glm::vec4 &value) const |
| |
| void | SetUniform (int location, const glm::mat4 &value) const |
| |
| void | SetUniform (int location, const glm::ivec2 &value) const |
| |
| void | SetUniform (int location, const glm::ivec3 &value) const |
| |
| void | SetUniform (int location, const std::vector< float > &value) const |
| |
| template<typename T > |
| void | SetUniformArray (const std::string &name, int count, const T *values) const |
| |
| void | SetUniformArray (int location, int count, const int *values) const |
| |
| void | SetUniformArray (int location, int count, const float *values) const |
| |
| void | SetUniformArray (int location, int count, const glm::vec3 *values) const |
| |
| void | SetUniformArray (int location, int count, const glm::vec4 *values) const |
| |
| template<typename T > |
| bool | SetSampler (const std::string &name, const T &texture) const |
| |
| std::string | GetLog () const |
| |
| void | PrintUniforms () const |
| |
| | MyBase () |
| |
| const string & | getClassName () const |
| |
Provides a C++ interface to the OpenGL shader program construct.
- Author
- Stanislaw Jaroszynski
- Date
- August, 2018
Automatically manages sampler uniforms and the active gl texture. This allows samplers to be set simply like uniforms.
Definition at line 25 of file ShaderProgram.h.
◆ Policy
◆ ShaderProgram()
| VAPoR::ShaderProgram::ShaderProgram |
( |
| ) |
|
◆ ~ShaderProgram()
| VAPoR::ShaderProgram::~ShaderProgram |
( |
| ) |
|
◆ AddShader()
| void VAPoR::ShaderProgram::AddShader |
( |
Shader * |
s | ) |
|
◆ AddShaderFromSource()
| int VAPoR::ShaderProgram::AddShaderFromSource |
( |
unsigned int |
type, |
|
|
const char * |
source |
|
) |
| |
- Parameters
-
| [in] | type | OpenGL shader type enum |
| [in] | source | GLSL source code |
- Return values
-
| 1 | is returned on success |
| -1 | is returned on failure |
◆ Bind()
| void VAPoR::ShaderProgram::Bind |
( |
| ) |
|
◆ ComputeSamplerLocations()
| void VAPoR::ShaderProgram::ComputeSamplerLocations |
( |
| ) |
|
◆ GetAttributeLocation()
| int VAPoR::ShaderProgram::GetAttributeLocation |
( |
const std::string & |
name | ) |
const |
◆ GetBoundProgramID()
| static int VAPoR::ShaderProgram::GetBoundProgramID |
( |
| ) |
|
|
static |
◆ GetID()
| unsigned int VAPoR::ShaderProgram::GetID |
( |
| ) |
const |
◆ GetLog()
| std::string VAPoR::ShaderProgram::GetLog |
( |
| ) |
const |
◆ GetUniformLocation()
| int VAPoR::ShaderProgram::GetUniformLocation |
( |
const std::string & |
name | ) |
const |
◆ GLTypeToString()
| static const char * VAPoR::ShaderProgram::GLTypeToString |
( |
const unsigned int |
type | ) |
|
|
static |
◆ HasUniform()
| bool VAPoR::ShaderProgram::HasUniform |
( |
const std::string & |
name | ) |
const |
◆ IsBound()
| bool VAPoR::ShaderProgram::IsBound |
( |
| ) |
const |
◆ IsGLTypeSampler()
| static bool VAPoR::ShaderProgram::IsGLTypeSampler |
( |
const unsigned int |
type | ) |
|
|
static |
◆ Link()
| int VAPoR::ShaderProgram::Link |
( |
| ) |
|
- Return values
-
| 1 | is returned on success |
| -1 | is returned on failure |
◆ PrintUniforms()
| void VAPoR::ShaderProgram::PrintUniforms |
( |
| ) |
const |
◆ SetSampler()
template<typename T >
| bool VAPoR::ShaderProgram::SetSampler |
( |
const std::string & |
name, |
|
|
const T & |
texture |
|
) |
| const |
This function behaves just like setting a uniform
- Parameters
-
- Return values
-
| false | if uniform name is not found |
◆ SetUniform() [1/10]
template<typename T >
| bool VAPoR::ShaderProgram::SetUniform |
( |
const std::string & |
name, |
|
|
const T & |
value |
|
) |
| const |
◆ SetUniform() [2/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const float & |
value |
|
) |
| const |
◆ SetUniform() [3/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::ivec2 & |
value |
|
) |
| const |
◆ SetUniform() [4/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::ivec3 & |
value |
|
) |
| const |
◆ SetUniform() [5/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::mat4 & |
value |
|
) |
| const |
◆ SetUniform() [6/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::vec2 & |
value |
|
) |
| const |
◆ SetUniform() [7/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::vec3 & |
value |
|
) |
| const |
◆ SetUniform() [8/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const glm::vec4 & |
value |
|
) |
| const |
◆ SetUniform() [9/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const int & |
value |
|
) |
| const |
◆ SetUniform() [10/10]
| void VAPoR::ShaderProgram::SetUniform |
( |
int |
location, |
|
|
const std::vector< float > & |
value |
|
) |
| const |
◆ SetUniformArray() [1/5]
template<typename T >
| void VAPoR::ShaderProgram::SetUniformArray |
( |
const std::string & |
name, |
|
|
int |
count, |
|
|
const T * |
values |
|
) |
| const |
◆ SetUniformArray() [2/5]
| void VAPoR::ShaderProgram::SetUniformArray |
( |
int |
location, |
|
|
int |
count, |
|
|
const float * |
values |
|
) |
| const |
◆ SetUniformArray() [3/5]
| void VAPoR::ShaderProgram::SetUniformArray |
( |
int |
location, |
|
|
int |
count, |
|
|
const glm::vec3 * |
values |
|
) |
| const |
◆ SetUniformArray() [4/5]
| void VAPoR::ShaderProgram::SetUniformArray |
( |
int |
location, |
|
|
int |
count, |
|
|
const glm::vec4 * |
values |
|
) |
| const |
◆ SetUniformArray() [5/5]
| void VAPoR::ShaderProgram::SetUniformArray |
( |
int |
location, |
|
|
int |
count, |
|
|
const int * |
values |
|
) |
| const |
◆ UnBind()
| static void VAPoR::ShaderProgram::UnBind |
( |
| ) |
|
|
static |
◆ WasLinkingSuccessful()
| unsigned int VAPoR::ShaderProgram::WasLinkingSuccessful |
( |
| ) |
const |
◆ UniformNotFoundPolicy
| Policy VAPoR::ShaderProgram::UniformNotFoundPolicy |
|
static |
The documentation for this class was generated from the following file: