OGLplus (0.45.0) a C++ wrapper for OpenGL

oglplus::LazyProgramUniform< T, Typecheck > Class Template Reference

Class encapsulating ProgramUniform shader variable functionality. More...

#include </home/chochlik/devel/oglplus/include/oglplus/uniform.hpp>

Inheritance diagram for oglplus::LazyProgramUniform< T, Typecheck >:
Collaboration diagram for oglplus::LazyProgramUniform< T, Typecheck >:

Public Member Functions

 LazyProgramUniform (const ProgramOps &program, String identifier)
 Construction from a const reference to program and an identifier.
 
 operator bool (void)
 Equivalent to IsActive() More...
 
bool operator! (void)
 Equivalent to !IsActive() More...
 
void Set (aux::AdjustUniformType< T >::Typevalue)
 Set the value of the uniform variable. More...
 
void Set (GLsizei count, const aux::AdjustUniformType< T >::Type *v)
 Set the multiple value(s) of the uniform variable. More...
 
void Set (const std::vector< aux::AdjustUniformType< T >::Type > &v)
 Set the value(s) of the uniform variable. More...
 
void Set (aux::AdjustUniformType< T >::Typev, P...p)
 Set the multiple value(s) of the uniform variable. More...
 
void SetVector (aux::AdjustUniformType< T >::Typev, P...p)
 Set the vector value of the uniform variable. More...
 
void SetVector (const aux::AdjustUniformType< T >::Type *v)
 Set the vector value of the uniform variable. More...
 
void SetVectors (GLsizei count, const aux::AdjustUniformType< T >::Type *v)
 Set multiple scalar or vector values of an uniform variable. More...
 
void SetVectors (const std::vector< aux::AdjustUniformType< T >::Type > &v)
 Set multiple scalar or vector values of an uniform variable. More...
 
void SetMatrix (std::size_t count, const aux::AdjustUniformType< T >::Type *v)
 Set the matrix components of the uniform variable. More...
 
void SetMatrix (aux::AdjustUniformType< T >::Typev, P...p)
 Set the matrix components of the uniform variable. More...
 
bool IsActive (void)
 Tests if this Uniform is initialized and can be used. More...
 
GLint Location (void) const
 Returns the location of this uniform in a program.
 
Program::ActiveVariableInfo Info (void)
 Returns a Program::ActiveVariableInfo for this uniform. More...
 

Detailed Description

template<typename T, class Typecheck = NoTypecheck>
class oglplus::LazyProgramUniform< T, Typecheck >

Class encapsulating ProgramUniform shader variable functionality.

The difference between ProgramUniform and LazyProgramUniform is, that ProgramUniform tries to get the location (binding) of the GLSL uniform variable in a Program during construction and LazyProgramUniform postpones this initialization until the value is actually needed at the cost of having to internally store the identifer in a String.

See Also
Uniform
LazyProgramUniform

Member Function Documentation

Returns a Program::ActiveVariableInfo for this uniform.

Note that this is a rather inefficient operation.

bool oglplus::UniformOps< Unspecified , Unspecified >::IsActive ( void  )
inherited

Tests if this Uniform is initialized and can be used.

For Uniform and ProgramUniform this function always returns true as these cannot be in uninitialized state. For LazyUniform, LazyProgramUniform, OptionalUniform, etc. this function returns true if the uniform is active and can be used for subsequent value-setting operations. If this function returns false then trying to set a value or any other operation on the uniform besides destruction throws an exception.

oglplus::UniformTpl< aux::AdjustUniformType< T >::Type , T , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::operator bool ( void  )
inherited

Equivalent to IsActive()

See Also
IsActive
bool oglplus::UniformTpl< aux::AdjustUniformType< T >::Type , T , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::operator! ( void  )
inherited

Equivalent to !IsActive()

See Also
IsActive
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::Set ( aux::AdjustUniformType< T >::Type  value)
inherited

Set the value of the uniform variable.

Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::Set ( GLsizei  count,
const aux::AdjustUniformType< T >::Type *  v 
)
inherited

Set the multiple value(s) of the uniform variable.

Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::Set ( const std::vector< aux::AdjustUniformType< T >::Type > &  v)
inherited

Set the value(s) of the uniform variable.

Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::Set ( aux::AdjustUniformType< T >::Type  v,
P...  p 
)
inherited

Set the multiple value(s) of the uniform variable.

Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetMatrix ( std::size_t  count,
const aux::AdjustUniformType< T >::Type *  v 
)
inherited

Set the matrix components of the uniform variable.

Note
Consider using Uniform<Matrix<T,M,N>> instead
Related OpenGL symbols:
glUniformMatrix glProgramUniformMatrix
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetMatrix ( aux::AdjustUniformType< T >::Type  v,
P...  p 
)
inherited

Set the matrix components of the uniform variable.

Note
Consider using Uniform<Matrix<T,M,N>> instead
Related OpenGL symbols:
glUniformMatrix glProgramUniformMatrix
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetVector ( aux::AdjustUniformType< T >::Type  v,
P...  p 
)
inherited

Set the vector value of the uniform variable.

This function can be used to set uniform variables with 2, 3 or 4 -component vector types with the same underlying type as is the template parameter of the Uniform or ProgramUniform class. For example Uniform<GLfloat>::SetVector() can be used to set the values of GLSL uniforms with vec2, vec3 or vec4 type, Uniform<GLint>::SetVector() can be used to set the values of GLSL uniforms with ivec2, ivec3 or ivec4 type, etc.

Note
Consider using Uniform<Vector<T,N>>Set() instead of Uniform<T>::SetVector<N>().
This function is not intended for setting arrays of uniform variables.
Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetVector ( const aux::AdjustUniformType< T >::Type *  v)
inherited

Set the vector value of the uniform variable.

This function can be used to set uniform variables with 2, 3 or 4 -component vector types with the same underlying type as is the template parameter of the Uniform or ProgramUniform class.

For example Uniform<GLfloat>::SetVector() can be used to set the values of GLSL uniforms with vec2, vec3 or vec4 type, Uniform<GLint>::SetVector() can be used to set the values of GLSL uniforms with ivec2, ivec3 or ivec4 type, etc.

Note
Consider using Uniform<Vector<T,N>>Set() instead of Uniform<T>::SetVector<N>().
This function is not intended for setting arrays of uniform variables.
Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetVectors ( GLsizei  count,
const aux::AdjustUniformType< T >::Type *  v 
)
inherited

Set multiple scalar or vector values of an uniform variable.

This function can be used to set multiple values of an uniform array variable with scalar or vector type with 2, 3 or 4 -components with the same underlying type as is the template parameter of the Uniform or ProgramUniform class.

For example Uniform<GLfloat>::SetVector() can be used to set the values of GLSL uniforms with vec2, vec3 or vec4 type, Uniform<GLint>::SetVector() can be used to set the values of GLSL uniforms with ivec2, ivec3 or ivec4 type, etc.

Note
Consider using Uniform<T>::Set() or Uniform<Vector<T,N>>Set() instead of SetVectors.
Related OpenGL symbols:
glUniform glProgramUniform
void oglplus::UniformSpecOps< aux::AdjustUniformType< T >::Type , Unspecified , Unspecified , Unspecified< aux::AdjustUniformType< T >::Type > >::SetVectors ( const std::vector< aux::AdjustUniformType< T >::Type > &  v)
inherited

Set multiple scalar or vector values of an uniform variable.

This function can be used to set multiple values of an uniform array variable with scalar or vector type with 2, 3 or 4 -components with the same underlying type as is the template parameter of the Uniform or ProgramUniform class.

For example Uniform<GLfloat>::SetVector() can be used to set the values of GLSL uniforms with vec2, vec3 or vec4 type, Uniform<GLint>::SetVector() can be used to set the values of GLSL uniforms with ivec2, ivec3 or ivec4 type, etc.

Note
Consider using Uniform<T>::Set() or Uniform<Vector<T,N>>Set() instead of SetVectors.
Related OpenGL symbols:
glUniform glProgramUniform

The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/uniform.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Wed Apr 30 2014 by Doxygen (version 1.8.4).