FastUIDraw
Namespaces | Classes | Macros | Functions
GL Utility

Collection of utility interfaces used by GL Backend that an application may wish to use as well. More...

Namespaces

 fastuidraw::gl_binding
 Provides interface for application to use GL where function pointers are auto-resolved transparently and under debug provides error checking. Built as a part of a seperate library; for GL it is libNGL; for GLES it is NGLES. The header defines for each GL/GLES function, glFoo, the macro fastuidraw_glFoo.
 

Classes

class  fastuidraw::gl::BindAttribute
 A BindAttribute inherits from PreLinkAction, it's purpose is to bind named attributes to named locations, i.e. it calls glBindAttributeLocation(). More...
 
class  fastuidraw::gl::BindFragDataLocation
 A BindFragDataLocation inherits from PreLinkAction, its purpose is to bind a fragment shader out to a named location and index. Using a BindFragDataLocation requires: More...
 
class  fastuidraw::gl::ContextProperties
 A ContextProperties provides an interface to query GL/GLES version and extensions. More...
 
class  fastuidraw::gl::PreLinkAction
 A PreLinkAction is an action to apply to a Program after attaching shaders but before linking. More...
 
class  fastuidraw::gl::PreLinkActionArray
 A PreLinkActionArray is a conveniance class wrapper over an array of PreLinkAction handles. More...
 
class  fastuidraw::gl::Program
 Class for creating and using GLSL programs. More...
 
class  fastuidraw::gl::ProgramInitializer
 A ProgramInitializer is a functor object called the first time a Program is bound (i.e. the first time Program::use_program() is called). It's main purpose is to facilitate initializing uniform values. More...
 
class  fastuidraw::gl::ProgramInitializerArray
 Conveniance class to hold an array of handles of ProgramInitializer objects. More...
 
class  fastuidraw::gl::ProgramSeparable
 A ProgramSeparable inherits from PreLinkAction, its purpose is to set a GLSL program as separable, so that it can be used by a GLSL pipeline. Using a ProgramSeparable requires: More...
 
class  fastuidraw::gl::SamplerInitializer
 Class to intialize the binding points of samplers. If the uniform is an array, the first element will be given the specified binding point and successive elements in the array will be given successive binding points. More...
 
class  fastuidraw::gl::Shader
 Simple Shader utility class providing a simple interface to build GL shader objects using a glsl::ShaderSouce as its source code. More...
 
class  fastuidraw::gl::ShaderStorageBlockInitializer
 A ShaderStorageBlockInitializer is used to initalize the binding point used by a shader storage block (see the GL spec on glShaderStorageBlockBinding). Initializer is not supported in OpenGL ES. More...
 
class  fastuidraw::gl::TransformFeedbackVarying
 A TransformFeedbackVarying encapsulates a call to glTransformFeedbackVarying. Note that if there are multiple TransformFeedbackVarying objects on a single PreLinkActionArray, then only the last one added has effect. More...
 
class  fastuidraw::gl::UniformBlockInitializer
 A UniformBlockInitializer is used to initalize the binding point used by a bindable uniform (aka Uniform buffer object, see the GL spec on glGetUniformBlockIndex and glUniformBlockBinding. More...
 
class  fastuidraw::gl::UniformInitalizerBase
 A UniformInitalizerBase is a base class for initializing a uniform, the actual GL call to set the uniform value is to be implemented by a derived class in init_uniform(). More...
 
class  fastuidraw::gl::UniformInitializer< T >
 Initialize a uniform via the templated overloaded function fastuidraw::gl::Uniform(). More...
 
class  fastuidraw::gl::UniformInitializer< c_array< const T > >
 Specialization for type c_array<const T> for UniformInitializer so that data behind the c_array is copied. More...
 

Macros

#define FASTUIDRAW_GL_MESSAGE(X)   gl_binding::message(X, __FILE__, __LINE__)
 

Functions

ProgramInitializerArrayfastuidraw::gl::ProgramInitializerArray::add_sampler_initializer (c_string uniform_name, int value)
 
ProgramInitializerArrayfastuidraw::gl::ProgramInitializerArray::add_uniform_block_binding (c_string uniform_name, int value)
 
template<typename T >
ProgramInitializerArrayfastuidraw::gl::ProgramInitializerArray::add_uniform_initializer (c_string uniform_name, const T &value)
 
void fastuidraw::gl::context_get (GLenum v, GLint *ptr)
 
void fastuidraw::gl::context_get (GLenum v, GLboolean *ptr)
 
void fastuidraw::gl::context_get (GLenum v, bool *ptr)
 
void fastuidraw::gl::context_get (GLenum v, GLfloat *ptr)
 
template<typename T , size_t N>
void fastuidraw::gl::context_get (GLenum v, vecN< T, N > *p)
 
template<typename T >
fastuidraw::gl::context_get (GLenum value)
 
template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, const vecN< T, N > &v)
 Template version for setting array of uniforms,. More...
 
template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, const vecN< T, N > &v, bool transposed)
 
template<typename T >
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, c_array< const T > v)
 Template version for setting array of uniforms,. More...
 
template<typename T >
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, c_array< const T > v, bool transposed)
 Template version for setting array of uniforms. More...
 
template<typename T >
void fastuidraw::gl::ProgramUniform (GLuint program, int location, c_array< const T > v)
 Template version for setting array of uniforms,. More...
 
template<typename T >
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, const T *v)
 Template version for setting an of uniform values. More...
 
template<typename T , size_t N, size_t M>
void fastuidraw::gl::ProgramUniform (GLuint program, int location, GLsizei count, const matrixNxM< T, N, M > *v, bool transposed=false)
 Template version for setting an array of matrix uniform values. More...
 
template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform (GLuint program, int location, const vecN< T, N > &v)
 Template version for setting a single uniform value. More...
 
template<typename T , size_t N, size_t M>
void fastuidraw::gl::ProgramUniform (GLuint program, int location, const matrixNxM< T, N, M > &v, bool transposed=false)
 Template version for setting a single matrix uniform value. More...
 
template<typename T , size_t N>
void fastuidraw::gl::Uniform (int location, GLsizei count, const vecN< T, N > &v)
 Template version for setting array of uniforms. More...
 
template<typename T , size_t N>
void fastuidraw::gl::Uniform (int location, GLsizei count, const vecN< T, N > &v, bool transposed)
 Template version for setting array of uniform matrices. More...
 
template<typename T >
void fastuidraw::gl::Uniform (int location, GLsizei count, c_array< const T > v)
 Template version for setting array of uniforms. More...
 
template<typename T >
void fastuidraw::gl::Uniform (int location, GLsizei count, c_array< const T > v, bool transposed)
 Template version for setting array of uniforms. More...
 
template<typename T >
void fastuidraw::gl::Uniform (int location, c_array< const T > v)
 Template version for setting array of uniforms,. More...
 
template<typename T >
void fastuidraw::gl::Uniform (int location, GLsizei count, const T *v)
 Template version for setting an of uniform values. More...
 
template<typename T , size_t N, size_t M>
void fastuidraw::gl::Uniform (int location, GLsizei count, const matrixNxM< T, N, M > *v, bool transposed=false)
 Template version for setting an array of matrix uniform values. More...
 
template<typename T , size_t N>
void fastuidraw::gl::Uniform (int location, const vecN< T, N > &v)
 Template version for setting a single uniform value. More...
 
template<typename T , size_t N, size_t M>
void fastuidraw::gl::Uniform (int location, const matrixNxM< T, N, M > &v, bool transposed=false)
 Template version for setting a single matrix uniform value. More...
 

Detailed Description

Collection of utility interfaces used by GL Backend that an application may wish to use as well.

Macro Definition Documentation

◆ FASTUIDRAW_GL_MESSAGE

#define FASTUIDRAW_GL_MESSAGE (   X)    gl_binding::message(X, __FILE__, __LINE__)

Use this macro to emit a string to each of the gl_binding::CallbackGL objects that are active.

Definition at line 139 of file gl_binding.hpp.

Function Documentation

◆ add_sampler_initializer()

ProgramInitializerArray & fastuidraw::gl::ProgramInitializerArray::add_sampler_initializer ( c_string  uniform_name,
int  value 
)
inline

Provided as a conveniance, creates a SamplerInitializer object and adds that via add().

Parameters
uniform_namename of uniform in GLSL to initialize
valuevalue with which to set the uniform, in this case specifies the texture unit as follows: a value of n means to use GL_TEXTUREn texture unit.

Definition at line 1688 of file gl_program.hpp.

◆ add_uniform_block_binding()

ProgramInitializerArray & fastuidraw::gl::ProgramInitializerArray::add_uniform_block_binding ( c_string  uniform_name,
int  value 
)
inline

Provided as a conveniance, creates a UniformBlockInitializer object and adds that via add().

Parameters
uniform_namename of uniform in GLSL to initialize
valuevalue with which to set the uniform, in this case specifies the binding point index to pass to glBindBufferBase or glBindBufferRange.

Definition at line 1696 of file gl_program.hpp.

◆ add_uniform_initializer()

template<typename T >
ProgramInitializerArray & fastuidraw::gl::ProgramInitializerArray::add_uniform_initializer ( c_string  uniform_name,
const T &  value 
)

Provided as a conveniance, creates a UniformInitializer object and adds that via add().

Parameters
uniform_namename of uniform in GLSL to initialize
valuevalue with which to set the uniform

Definition at line 1680 of file gl_program.hpp.

◆ context_get() [1/6]

void fastuidraw::gl::context_get ( GLenum  v,
GLint *  ptr 
)

Overloaded C++ version of glGet* family of functions in GL. Equivalent to glGetInteger(v, ptr).

Parameters
vGL enumeration to fetch
ptraddress to which to write values

◆ context_get() [2/6]

void fastuidraw::gl::context_get ( GLenum  v,
GLboolean *  ptr 
)

Overloaded C++ version of glGet* family of functions in GL. Equivalent to glGetBooleanv(v, ptr).

Parameters
vGL enumeration to fetch
ptraddress to which to write values

◆ context_get() [3/6]

void fastuidraw::gl::context_get ( GLenum  v,
bool *  ptr 
)

Overloaded C++ version of glGet* family of functions in GL. Equivalent to glGetBooleanv(v, ptr).

Parameters
vGL enumeration to fetch
ptraddress to which to write values

◆ context_get() [4/6]

void fastuidraw::gl::context_get ( GLenum  v,
GLfloat *  ptr 
)

Overloaded C++ version of glGet* family of functions in GL. Equivalent to glGetFloatv(v, ptr).

Parameters
vGL enumeration to fetch
ptraddress to which to write values

◆ context_get() [5/6]

template<typename T , size_t N>
void fastuidraw::gl::context_get ( GLenum  v,
vecN< T, N > *  p 
)

Overloaded C++ version of glGet* family of functions in GL, accepting the address of a vecN, by rules of template recursion, can take vecN's of other types.

Parameters
vGL enumeration to fetch
paddress to which to write values

Definition at line 86 of file gl_get.hpp.

◆ context_get() [6/6]

template<typename T >
T fastuidraw::gl::context_get ( GLenum  value)

Overloaded C++ version of glGet* family of functions in GL. The template parameter determines what glGet function is called. The return value is initialized as 0 before calling glGet(), thus if the GL implementation does not support that enum, the return value is 0.

Parameters
valueGL enumeration to fetch

Definition at line 102 of file gl_get.hpp.

◆ ProgramUniform() [1/9]

template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
const vecN< T, N > &  v 
)

Template version for setting array of uniforms,.

Equivalent to

ProgramUniform(program, location, count, v.c_ptr());
Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

Definition at line 204 of file gluniform.hpp.

◆ ProgramUniform() [2/9]

template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
const vecN< T, N > &  v,
bool  transposed 
)

Template version for setting array of uniform matrices, equivalent to

ProgramUniform(program, location, count, v.c_ptr(), transposed);

This call is for when v is an array of matrices.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use
transposedflag to indicate if the matrices are to be transposed

Definition at line 225 of file gluniform.hpp.

◆ ProgramUniform() [3/9]

template<typename T >
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
c_array< const T >  v 
)

Template version for setting array of uniforms,.

Equivalent to

ProgramUniform(program, location, count, &v[0]);
Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

Definition at line 247 of file gluniform.hpp.

◆ ProgramUniform() [4/9]

template<typename T >
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
c_array< const T >  v,
bool  transposed 
)

Template version for setting array of uniforms.

Equivalent to

ProgramUniform(program, location, count, &v[0], transposed);

This call is for when v is an array of matrices.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use
transposedflag to indicate if the matrices are to be transposed

Definition at line 297 of file gluniform.hpp.

◆ ProgramUniform() [5/9]

template<typename T >
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
c_array< const T >  v 
)

Template version for setting array of uniforms,.

Equivalent to

ProgramUniform(program, location, v.size(), &v[0]);
Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values

Definition at line 320 of file gluniform.hpp.

◆ ProgramUniform() [6/9]

template<typename T >
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
const T *  v 
)

Template version for setting an of uniform values.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

◆ ProgramUniform() [7/9]

template<typename T , size_t N, size_t M>
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
GLsizei  count,
const matrixNxM< T, N, M > *  v,
bool  transposed = false 
)

Template version for setting an array of matrix uniform values.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue
countnumber of elements from the array v to use.
transposedset to tue true if GL should interpret the matrices as transposed

◆ ProgramUniform() [8/9]

template<typename T , size_t N>
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
const vecN< T, N > &  v 
)

Template version for setting a single uniform value.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue

◆ ProgramUniform() [9/9]

template<typename T , size_t N, size_t M>
void fastuidraw::gl::ProgramUniform ( GLuint  program,
int  location,
const matrixNxM< T, N, M > &  v,
bool  transposed = false 
)

Template version for setting a single matrix uniform value.

Parameters
programGL name of program to which uniform(s) belong
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue
transposedset to tue true if GL should interpret the matrices as transposed

◆ Uniform() [1/9]

template<typename T , size_t N>
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
const vecN< T, N > &  v 
)

Template version for setting array of uniforms.

Equivalent to

Uniform(location, count, v.c_ptr());
Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

Definition at line 65 of file gluniform.hpp.

◆ Uniform() [2/9]

template<typename T , size_t N>
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
const vecN< T, N > &  v,
bool  transposed 
)

Template version for setting array of uniform matrices.

Equivalent to

Uniform(location, count, v.c_ptr(), transposed);

This call is for when v is an array of matrices.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use
transposedflag to indicate if the matrices are to be transposed

Definition at line 87 of file gluniform.hpp.

◆ Uniform() [3/9]

template<typename T >
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
c_array< const T >  v 
)

Template version for setting array of uniforms.

Equivalent to

Uniform(location, count, &v[0]);
Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

Definition at line 108 of file gluniform.hpp.

◆ Uniform() [4/9]

template<typename T >
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
c_array< const T >  v,
bool  transposed 
)

Template version for setting array of uniforms.

Equivalent to

Uniform(location, count, &v[0], transposed);

This call is for when v is an array of matrices.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use
transposedflag to indicate if the matrices are to be transposed

Definition at line 156 of file gluniform.hpp.

◆ Uniform() [5/9]

template<typename T >
void fastuidraw::gl::Uniform ( int  location,
c_array< const T >  v 
)

Template version for setting array of uniforms,.

Equivalent to

Uniform(location, v.size(), &v[0]);
Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values

Definition at line 178 of file gluniform.hpp.

◆ Uniform() [6/9]

template<typename T >
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
const T *  v 
)

Template version for setting an of uniform values.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
varray of values
countnumber of elements from the array v to use.

◆ Uniform() [7/9]

template<typename T , size_t N, size_t M>
void fastuidraw::gl::Uniform ( int  location,
GLsizei  count,
const matrixNxM< T, N, M > *  v,
bool  transposed = false 
)

Template version for setting an array of matrix uniform values.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue
countnumber of elements from the array v to use.
transposedset to tue true if GL should interpret the matrices as transposed

◆ Uniform() [8/9]

template<typename T , size_t N>
void fastuidraw::gl::Uniform ( int  location,
const vecN< T, N > &  v 
)

Template version for setting a single uniform value.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue

◆ Uniform() [9/9]

template<typename T , size_t N, size_t M>
void fastuidraw::gl::Uniform ( int  location,
const matrixNxM< T, N, M > &  v,
bool  transposed = false 
)

Template version for setting a single matrix uniform value.

Parameters
locationlocation of uniform, i.e. return value of glGetUniformLocation
vvalue
transposedset to tue true if GL should interpret the matrices as transposed