| globjects 1.0.0.000000000000 Strict OpenGL objects wrapper.

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
globjects::AbstractUniform Class Referenceabstract

Abstract base class for templated Uniforms. More...

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

Inheritance diagram for globjects::AbstractUniform:

## Public Types
enum | BindlessImplementation { SeparateShaderObjectsARB, Legacy }

## Public Member Functions
| 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

## Static Public Member Functions
static void | hintBindlessImplementation (const BindlessImplementation impl)

## Protected Member Functions
virtual | ~AbstractUniform ()
void | registerProgram (Program *program)
void | deregisterProgram (Program *program)
void | changed ()
void | update (const Program *program, bool invalidateLocation) const
virtual void | updateAt (const Program *program, gl::GLint location) const =0
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
LocationIdentity | m_identity
std::set< Program * > | m_programs
std::unordered_map< const Program *, gl::GLint > | m_locations

## Friends
class | Program
| Programs (de)register themselves. More...

## Detailed Description

Abstract base class for templated Uniforms.

Unifies the specialized Uniforms in order to be able to store them in a list or a vector.

See also
  Uniform
  Program

## Member Enumeration Documentation

## ◆ BindlessImplementation

enum globjects::AbstractUniform::BindlessImplementation

Enumerator
SeparateShaderObjectsARB |
Legacy |

## Constructor & Destructor Documentation

## ◆ AbstractUniform() [1/2]

globjects::AbstractUniform::AbstractUniform | ( | gl::GLint | location | ) |

## ◆ AbstractUniform() [2/2]

globjects::AbstractUniform::AbstractUniform | ( | const std::string & | name | ) |

## ◆ ~AbstractUniform()

virtual globjects::AbstractUniform::~AbstractUniform | ( |  | ) |
| protected virtual

## Member Function Documentation

## ◆ hintBindlessImplementation()

static void globjects::AbstractUniform::hintBindlessImplementation | ( | const BindlessImplementation | impl | ) |
| static

## ◆ name()

const std::string& globjects::AbstractUniform::name | ( |  | ) | const

## ◆ location()

gl::GLint globjects::AbstractUniform::location | ( |  | ) | const

## ◆ identity()

const LocationIdentity& globjects::AbstractUniform::identity | ( |  | ) | const

## ◆ as() [1/2]

template<typename T >

Uniform<T>* globjects::AbstractUniform::as | ( |  | ) |

Simplifies the often required casting of AbstractUniforms.

Returns
  a specialized Uniform of the requested type, returns a nullptr on a type mismatch

abstractUniform->as<float>()->setValue(3.142f);

## ◆ as() [2/2]

template<typename T >

const Uniform<T>* globjects::AbstractUniform::as | ( |  | ) | const

## ◆ registerProgram()

void globjects::AbstractUniform::registerProgram | ( | Program * | program | ) |
| protected

## ◆ deregisterProgram()

void globjects::AbstractUniform::deregisterProgram | ( | Program * | program | ) |
| protected

## ◆ changed()

void globjects::AbstractUniform::changed | ( |  | ) |
| protected

Iterates over all programs attached to and calls update. Should be called on every value change (i.e., in Uniform).

## ◆ update()

void globjects::AbstractUniform::update | ( | const Program * | program,
|  | bool | invalidateLocation
| ) |  | const
| protected

Sets the uniform's value on the program.

## ◆ updateAt()

virtual void globjects::AbstractUniform::updateAt | ( | const Program * | program,
|  | gl::GLint | location
| ) |  | const
| protected pure virtual

This function requires knowledge of the unifom's value.

Implemented in globjects::Uniform< T >.

## ◆ locationFor()

gl::GLint globjects::AbstractUniform::locationFor | ( | const Program * | program | ) | const
| protected

## ◆ setValue() [1/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const float & | value
| ) |  | const
| protected

## ◆ setValue() [2/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const int & | value
| ) |  | const
| protected

## ◆ setValue() [3/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const unsigned int & | value
| ) |  | const
| protected

## ◆ setValue() [4/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const bool & | value
| ) |  | const
| protected

## ◆ setValue() [5/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::vec2 & | value
| ) |  | const
| protected

## ◆ setValue() [6/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::vec3 & | value
| ) |  | const
| protected

## ◆ setValue() [7/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::vec4 & | value
| ) |  | const
| protected

## ◆ setValue() [8/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::ivec2 & | value
| ) |  | const
| protected

## ◆ setValue() [9/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::ivec3 & | value
| ) |  | const
| protected

## ◆ setValue() [10/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::ivec4 & | value
| ) |  | const
| protected

## ◆ setValue() [11/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::uvec2 & | value
| ) |  | const
| protected

## ◆ setValue() [12/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::uvec3 & | value
| ) |  | const
| protected

## ◆ setValue() [13/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::uvec4 & | value
| ) |  | const
| protected

## ◆ setValue() [14/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat2 & | value
| ) |  | const
| protected

## ◆ setValue() [15/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat3 & | value
| ) |  | const
| protected

## ◆ setValue() [16/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat4 & | value
| ) |  | const
| protected

## ◆ setValue() [17/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat2x3 & | value
| ) |  | const
| protected

## ◆ setValue() [18/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat3x2 & | value
| ) |  | const
| protected

## ◆ setValue() [19/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat2x4 & | value
| ) |  | const
| protected

## ◆ setValue() [20/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat4x2 & | value
| ) |  | const
| protected

## ◆ setValue() [21/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat3x4 & | value
| ) |  | const
| protected

## ◆ setValue() [22/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const glm::mat4x3 & | value
| ) |  | const
| protected

## ◆ setValue() [23/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const gl::GLuint64 & | value
| ) |  | const
| protected

## ◆ setValue() [24/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const TextureHandle & | value
| ) |  | const
| protected

## ◆ setValue() [25/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< float > & | value
| ) |  | const
| protected

## ◆ setValue() [26/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< int > & | value
| ) |  | const
| protected

## ◆ setValue() [27/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< unsigned int > & | value
| ) |  | const
| protected

## ◆ setValue() [28/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< bool > & | value
| ) |  | const
| protected

## ◆ setValue() [29/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::vec2 > & | value
| ) |  | const
| protected

## ◆ setValue() [30/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::vec3 > & | value
| ) |  | const
| protected

## ◆ setValue() [31/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::vec4 > & | value
| ) |  | const
| protected

## ◆ setValue() [32/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::ivec2 > & | value
| ) |  | const
| protected

## ◆ setValue() [33/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::ivec3 > & | value
| ) |  | const
| protected

## ◆ setValue() [34/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::ivec4 > & | value
| ) |  | const
| protected

## ◆ setValue() [35/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::uvec2 > & | value
| ) |  | const
| protected

## ◆ setValue() [36/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::uvec3 > & | value
| ) |  | const
| protected

## ◆ setValue() [37/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::uvec4 > & | value
| ) |  | const
| protected

## ◆ setValue() [38/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat2 > & | value
| ) |  | const
| protected

## ◆ setValue() [39/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat3 > & | value
| ) |  | const
| protected

## ◆ setValue() [40/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat4 > & | value
| ) |  | const
| protected

## ◆ setValue() [41/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat2x3 > & | value
| ) |  | const
| protected

## ◆ setValue() [42/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat3x2 > & | value
| ) |  | const
| protected

## ◆ setValue() [43/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat2x4 > & | value
| ) |  | const
| protected

## ◆ setValue() [44/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat4x2 > & | value
| ) |  | const
| protected

## ◆ setValue() [45/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat3x4 > & | value
| ) |  | const
| protected

## ◆ setValue() [46/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< glm::mat4x3 > & | value
| ) |  | const
| protected

## ◆ setValue() [47/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< gl::GLuint64 > & | value
| ) |  | const
| protected

## ◆ setValue() [48/49]

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::vector< TextureHandle > & | value
| ) |  | const
| protected

## ◆ setValue() [49/49]

template<typename T , std::size_t Count>

void globjects::AbstractUniform::setValue | ( | const Program * | program,
|  | gl::GLint | location,
|  | const std::array< T, Count > & | value
| ) |  | const
| protected

## Friends And Related Function Documentation

## ◆ Program

friend class Program
| friend

Programs (de)register themselves.

## Member Data Documentation

## ◆ m_identity

LocationIdentity globjects::AbstractUniform::m_identity
| protected

## ◆ m_programs

std::set<Program *> globjects::AbstractUniform::m_programs
| protected

## ◆ m_locations

std::unordered_map<const Program *, gl::GLint> globjects::AbstractUniform::m_locations
| mutable protected

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

- AbstractUniform.h