Loading...
Searching...
No Matches
globjects::Uniform< T > Class Template Reference

Wraps access to typed global GLSL variables. More...

`#include <globjects/include/globjects/Uniform.h>`

Inheritance diagram for globjects::Uniform< T >:

## Public Member Functions

| Uniform (gl::GLint location)
| Uniform (gl::GLint location, const T &value)
| Uniform (const std::string &name)
| Uniform (const std::string &name, const T &value)
void | set (const T &value)
const T & | value () const
Public Member Functions inherited from globjects::AbstractUniform
| AbstractUniform (gl::GLint location)
| AbstractUniform (const std::string &name)
const std::string & | name () const
gl::GLint | location () const
const LocationIdentity & | identity () const
template<typename T >
Uniform< T > * | as ()
template<typename T >
const Uniform< T > * | as () const
Public Member Functions inherited from globjects::Referenced
| Referenced ()
void | ref () const
void | unref () const
int | refCounter () const
Public Member Functions inherited from globjects::HeapOnly
| HeapOnly ()
void | destroy () const

## Protected Member Functions

virtual | ~Uniform ()
virtual void | updateAt (const Program *program, gl::GLint location) const override
Protected Member Functions inherited from globjects::AbstractUniform
virtual | ~AbstractUniform ()
void | registerProgram (Program *program)
void | deregisterProgram (Program *program)
void | changed ()
void | update (const Program *program, bool invalidateLocation) const
gl::GLint | locationFor (const Program *program) const
void | setValue (const Program *program, gl::GLint location, const float &value) const
void | setValue (const Program *program, gl::GLint location, const int &value) const
void | setValue (const Program *program, gl::GLint location, const unsigned int &value) const
void | setValue (const Program *program, gl::GLint location, const bool &value) const
void | setValue (const Program *program, gl::GLint location, const glm::vec2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::vec3 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::vec4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::ivec2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::ivec3 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::ivec4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::uvec2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::uvec3 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::uvec4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat3 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat2x3 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat3x2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat2x4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat4x2 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat3x4 &value) const
void | setValue (const Program *program, gl::GLint location, const glm::mat4x3 &value) const
void | setValue (const Program *program, gl::GLint location, const gl::GLuint64 &value) const
void | setValue (const Program *program, gl::GLint location, const TextureHandle &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< float > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< int > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< unsigned int > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< bool > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::vec2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::vec3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::vec4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2x3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3x2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2x4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4x2 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3x4 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4x3 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< gl::GLuint64 > &value) const
void | setValue (const Program *program, gl::GLint location, const std::vector< TextureHandle > &value) const
template<typename T , std::size_t Count>
void | setValue (const Program *program, gl::GLint location, const std::array< T, Count > &value) const
Protected Member Functions inherited from globjects::Referenced
virtual | ~Referenced ()
Protected Member Functions inherited from globjects::HeapOnly
virtual | ~HeapOnly ()

## Protected Attributes

T | m_value
| The uniforms value, explictly required when relinking programs.
Protected Attributes inherited from globjects::AbstractUniform
LocationIdentity | m_identity
std::set< Program * > | m_programs
std::unordered_map< const Program *, gl::GLint > | m_locations

## Additional Inherited Members

Public Types inherited from globjects::AbstractUniform
enum | BindlessImplementation { SeparateShaderObjectsARB , Legacy }
Static Public Member Functions inherited from globjects::AbstractUniform
static void | hintBindlessImplementation (const BindlessImplementation impl)

## Detailed Description

template<typename T>
class globjects::Uniform< T >

Wraps access to typed global GLSL variables.

The Uniform class wraps access to typed global GLSL variables (uniforms). These are stored in the OpenGL program objects itself.

Supported OpenGL uniform setters are wrapped via specialized template set implementations. Note that unsupported uniform types result in compile time errors due to the default implementation of set.

Simple usage of an Uniform:

Uniform<float> * u = new Uniform<float>("u_ratio");
u->set(1.618f);
program->addUniform(u);
globjects::Uniform
Wraps access to typed global GLSL variables.
Definition Uniform.h:37
globjects::Uniform::set
void set(const T &value)

See also
  AbstractUniform
  Program
  http://www.opengl.org/wiki/Uniform

## Constructor & Destructor Documentation

## Uniform() [1/4]

template<typename T >

globjects::Uniform< T >::Uniform | ( | gl::GLint | location | ) |

## Uniform() [2/4]

template<typename T >

globjects::Uniform< T >::Uniform | ( | gl::GLint | location,
|  | const T & | value
| ) |  |

## Uniform() [3/4]

template<typename T >

globjects::Uniform< T >::Uniform | ( | const std::string & | name | ) |

## Uniform() [4/4]

template<typename T >

globjects::Uniform< T >::Uniform | ( | const std::string & | name,
|  | const T & | value
| ) |  |

## ~Uniform()

template<typename T >

virtual globjects::Uniform< T >::~Uniform | ( |  | ) |

protected virtual

## Member Function Documentation

## set()

template<typename T >

void globjects::Uniform< T >::set | ( | const T & | value | ) |

## value()

template<typename T >

const T & globjects::Uniform< T >::value | ( |  | ) | const

## updateAt()

template<typename T >

virtual void globjects::Uniform< T >::updateAt | ( | const Program * | program,
|  | gl::GLint | location
| ) |  | const

override protected virtual

This function requires knowledge of the unifom's value.

Implements globjects::AbstractUniform.

## Member Data Documentation

## m_value

template<typename T >

T globjects::Uniform< T >::m_value

protected

The uniforms value, explictly required when relinking programs.

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

- AbstractUniform.h
- Uniform.h