sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::Shader Class Reference

Manager shaders. More...

#include <shader.h>

Public Member Functions

bool attach_file (const std::string &filename, GLenum type)
 Compiles and attaches shader files.
bool attach_string (const std::string &shader_string, GLenum type)
 Compiles and attaches shader strings.
void set_transform_feedback_variables (std::vector< std::string > &variables, GLenum buffer_mode)
 Sets the variable to record in transform feedback buffers.
void recompile ()
 Reads, compiles and links all associated shaders again.
bool link ()
 Links the attached shaders.
void bind ()
 Binds the shader and stores the previously bound shader.
void unbind ()
 Unbinds the shader and restores the previously bound shader.
int get_attribute_location (const std::string &name)
 Returns the location of an attribute variable.
int get_uniform_location (const std::string &name)
 Returns the location of a uniform variable.
template<typename T>
void set_uniform (int location, T v0)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, T v0)
 Sets the uniform.
template<typename T>
void set_uniform (int location, T v0, T v1)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, T v0, T v1)
 Sets the uniform.
template<typename T>
void set_uniform (int location, T v0, T v1, T v2)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, T v0, T v1, T v2)
 Sets the uniform.
template<typename T>
void set_uniform (int location, T v0, T v1, T v2, T v3)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, T v0, T v1, T v2, T v3)
 Sets the uniform.
template<typename T>
void set_uniform (int location, unsigned int count, unsigned int elements, const T *value)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, unsigned int count, unsigned int elements, const T *value)
 Sets the uniform.
template<typename T>
void set_uniform (int location, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const T *value)
 Sets the uniform.
template<typename T>
void set_uniform (const std::string &name, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const T *value)
 Sets the uniform.
void set_uniform (int location, const glm::vec2 &value)
 Sets the uniform.
void set_uniform (int location, const glm::dvec2 &value)
 Sets the uniform.
void set_uniform (int location, const glm::vec3 &value)
 Sets the uniform.
void set_uniform (int location, const glm::dvec3 &value)
 Sets the uniform.
void set_uniform (int location, const glm::vec4 &value)
 Sets the uniform.
void set_uniform (int location, const glm::dvec4 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::vec2 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::dvec2 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::vec3 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::dvec3 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::vec4 &value)
 Sets the uniform.
void set_uniform (const std::string &name, const glm::dvec4 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::mat2 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::dmat2 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::mat3 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::dmat3 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::mat4 &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const glm::dmat4 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::mat2 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::dmat2 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::mat3 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::dmat3 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::mat4 &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const glm::dmat4 &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::vec2 > &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::dvec2 > &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::vec3 > &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::dvec3 > &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::vec4 > &value)
 Sets the uniform.
void set_uniform (int location, const std::vector< glm::dvec4 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::vec2 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::dvec2 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::vec3 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::dvec3 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::vec4 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, const std::vector< glm::dvec4 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::mat2 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::dmat2 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::mat3 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::dmat3 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::mat4 > &value)
 Sets the uniform.
void set_uniform (int location, bool transpose, const std::vector< glm::dmat4 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::mat2 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::dmat2 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::mat3 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::dmat3 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::mat4 > &value)
 Sets the uniform.
void set_uniform (const std::string &name, bool transpose, const std::vector< glm::dmat4 > &value)
 Sets the uniform.
template<>
void set_uniform (int location, int v0)
template<>
void set_uniform (int location, unsigned int v0)
template<>
void set_uniform (int location, float v0)
template<>
void set_uniform (int location, double v0)
template<>
void set_uniform (const std::string &name, int v0)
template<>
void set_uniform (const std::string &name, unsigned int v0)
template<>
void set_uniform (const std::string &name, float v0)
template<>
void set_uniform (const std::string &name, double v0)
template<>
void set_uniform (int location, int v0, int v1)
template<>
void set_uniform (int location, unsigned int v0, unsigned int v1)
template<>
void set_uniform (int location, float v0, float v1)
template<>
void set_uniform (int location, double v0, double v1)
template<>
void set_uniform (const std::string &name, int v0, int v1)
template<>
void set_uniform (const std::string &name, unsigned int v0, unsigned int v1)
template<>
void set_uniform (const std::string &name, float v0, float v1)
template<>
void set_uniform (const std::string &name, double v0, double v1)
template<>
void set_uniform (int location, int v0, int v1, int v2)
template<>
void set_uniform (int location, unsigned int v0, unsigned int v1, unsigned int v2)
template<>
void set_uniform (int location, float v0, float v1, float v2)
template<>
void set_uniform (int location, double v0, double v1, double v2)
template<>
void set_uniform (const std::string &name, int v0, int v1, int v2)
template<>
void set_uniform (const std::string &name, unsigned int v0, unsigned int v1, unsigned int v2)
template<>
void set_uniform (const std::string &name, float v0, float v1, float v2)
template<>
void set_uniform (const std::string &name, double v0, double v1, double v2)
template<>
void set_uniform (int location, int v0, int v1, int v2, int v3)
template<>
void set_uniform (int location, unsigned int v0, unsigned int v1, unsigned int v2, unsigned int v3)
template<>
void set_uniform (int location, float v0, float v1, float v2, float v3)
template<>
void set_uniform (int location, double v0, double v1, double v2, double v3)
template<>
void set_uniform (const std::string &name, int v0, int v1, int v2, int v3)
template<>
void set_uniform (const std::string &name, unsigned int v0, unsigned int v1, unsigned int v2, unsigned int v3)
template<>
void set_uniform (const std::string &name, float v0, float v1, float v2, float v3)
template<>
void set_uniform (const std::string &name, double v0, double v1, double v2, double v3)
template<>
void set_uniform (int location, unsigned int count, unsigned int elements, const int *value)
template<>
void set_uniform (int location, unsigned int count, unsigned int elements, const unsigned int *value)
template<>
void set_uniform (int location, unsigned int count, unsigned int elements, const float *value)
template<>
void set_uniform (int location, unsigned int count, unsigned int elements, const double *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int elements, const int *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int elements, const unsigned int *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int elements, const float *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int elements, const double *value)
template<>
void set_uniform (int location, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const float *value)
template<>
void set_uniform (int location, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const double *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const float *value)
template<>
void set_uniform (const std::string &name, unsigned int count, unsigned int columns, unsigned int rows, bool transpose, const double *value)

Static Public Member Functions

static void add_path (std::string path)
 Adds a path to the list of paths to be searched ▸ for image files.

Public Attributes

bool transform_feedback
 True if the shader records values into transform feedback buffer(s)
GLuint program
 Shader name.

Detailed Description

Manager shaders.

Definition at line 12 of file shader.h.

Constructor & Destructor Documentation

◆ Shader()

Shader::Shader ( )

Definition at line 17 of file shader.cpp.

◆ ~Shader()

Shader::~Shader ( )

Definition at line 36 of file shader.cpp.

Member Function Documentation

◆ add_path()

void Shader::add_path ( std::string path)
static

Adds a path to the list of paths to be searched ▸ for image files.

Parameters
pathThe path to add to the list
Note
To avoid duplicates this function first performs a search on existing entries.

Definition at line 9 of file shader.cpp.

◆ attach_file()

bool Shader::attach_file ( const std::string & filename,
GLenum type )

Compiles and attaches shader files.

Parameters
filenamePath to a shader source file
typeShader type
Returns
Returns true on success or false otherwise

Definition at line 40 of file shader.cpp.

◆ attach_string()

bool Shader::attach_string ( const std::string & shader_string,
GLenum type )

Compiles and attaches shader strings.

Parameters
shader_stringA string containing the shader
typeShader type
Returns
Returns true on success or false otherwise

Definition at line 103 of file shader.cpp.

◆ bind()

void Shader::bind ( )

Binds the shader and stores the previously bound shader.

Definition at line 180 of file shader.cpp.

◆ get_attribute_location()

int Shader::get_attribute_location ( const std::string & name)

Returns the location of an attribute variable.

Parameters
nameThe name of the attribute variable
Returns
Returns the location of the attribute variable or -1 if it is not found

Definition at line 195 of file shader.cpp.

◆ get_uniform_location()

int Shader::get_uniform_location ( const std::string & name)

Returns the location of a uniform variable.

Parameters
nameThe name of the uniform variable
Returns
Returns the location of the uniform variable or -1 if it is not found

Definition at line 199 of file shader.cpp.

◆ link()

bool Shader::link ( )

Links the attached shaders.

Returns
Returns true on success, false otherwise

Definition at line 160 of file shader.cpp.

◆ recompile()

void Shader::recompile ( )

Reads, compiles and links all associated shaders again.

Definition at line 145 of file shader.cpp.

◆ set_transform_feedback_variables()

void Shader::set_transform_feedback_variables ( std::vector< std::string > & variables,
GLenum buffer_mode )

Sets the variable to record in transform feedback buffers.

Parameters
variablesA list of variable names
buffer_modeThe mode used to capture the variables when transform feedback is active. Must be must be GL_INTERLEAVED_ATTRIBS or GL_SEPARATE_ATTRIBS.
Note
If the shader has already been linked, it will be relinked.
See also
link

Definition at line 133 of file shader.cpp.

◆ set_uniform() [1/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::dmat2 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 281 of file shader.cpp.

◆ set_uniform() [2/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::dmat3 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 293 of file shader.cpp.

◆ set_uniform() [3/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::dmat4 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 305 of file shader.cpp.

◆ set_uniform() [4/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::mat2 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 275 of file shader.cpp.

◆ set_uniform() [5/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::mat3 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 287 of file shader.cpp.

◆ set_uniform() [6/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const glm::mat4 & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 299 of file shader.cpp.

◆ set_uniform() [7/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::dmat2 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 414 of file shader.cpp.

◆ set_uniform() [8/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::dmat3 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 428 of file shader.cpp.

◆ set_uniform() [9/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::dmat4 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 442 of file shader.cpp.

◆ set_uniform() [10/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::mat2 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 407 of file shader.cpp.

◆ set_uniform() [11/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::mat3 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 421 of file shader.cpp.

◆ set_uniform() [12/104]

void Shader::set_uniform ( const std::string & name,
bool transpose,
const std::vector< glm::mat4 > & value )

Sets the uniform.

Parameters
nameThe uniform name
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 435 of file shader.cpp.

◆ set_uniform() [13/104]

void Shader::set_uniform ( const std::string & name,
const glm::dvec2 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 231 of file shader.cpp.

◆ set_uniform() [14/104]

void Shader::set_uniform ( const std::string & name,
const glm::dvec3 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 239 of file shader.cpp.

◆ set_uniform() [15/104]

void Shader::set_uniform ( const std::string & name,
const glm::dvec4 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 247 of file shader.cpp.

◆ set_uniform() [16/104]

void Shader::set_uniform ( const std::string & name,
const glm::vec2 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 227 of file shader.cpp.

◆ set_uniform() [17/104]

void Shader::set_uniform ( const std::string & name,
const glm::vec3 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 235 of file shader.cpp.

◆ set_uniform() [18/104]

void Shader::set_uniform ( const std::string & name,
const glm::vec4 & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 243 of file shader.cpp.

◆ set_uniform() [19/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::dvec2 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 340 of file shader.cpp.

◆ set_uniform() [20/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::dvec3 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 350 of file shader.cpp.

◆ set_uniform() [21/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::dvec4 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 360 of file shader.cpp.

◆ set_uniform() [22/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::vec2 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 335 of file shader.cpp.

◆ set_uniform() [23/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::vec3 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 345 of file shader.cpp.

◆ set_uniform() [24/104]

void Shader::set_uniform ( const std::string & name,
const std::vector< glm::vec4 > & value )

Sets the uniform.

Parameters
nameThe uniform name
valueA reference to the values

Definition at line 355 of file shader.cpp.

◆ set_uniform() [25/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
double v0 )
inline

Definition at line 650 of file shader.h.

◆ set_uniform() [26/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
double v0,
double v1 )
inline

Definition at line 698 of file shader.h.

◆ set_uniform() [27/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
double v0,
double v1,
double v2 )
inline

Definition at line 746 of file shader.h.

◆ set_uniform() [28/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
double v0,
double v1,
double v2,
double v3 )
inline

Definition at line 794 of file shader.h.

◆ set_uniform() [29/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
float v0 )
inline

Definition at line 644 of file shader.h.

◆ set_uniform() [30/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
float v0,
float v1 )
inline

Definition at line 692 of file shader.h.

◆ set_uniform() [31/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
float v0,
float v1,
float v2 )
inline

Definition at line 740 of file shader.h.

◆ set_uniform() [32/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
float v0,
float v1,
float v2,
float v3 )
inline

Definition at line 788 of file shader.h.

◆ set_uniform() [33/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
int v0 )
inline

Definition at line 632 of file shader.h.

◆ set_uniform() [34/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
int v0,
int v1 )
inline

Definition at line 680 of file shader.h.

◆ set_uniform() [35/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
int v0,
int v1,
int v2 )
inline

Definition at line 728 of file shader.h.

◆ set_uniform() [36/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
int v0,
int v1,
int v2,
int v3 )
inline

Definition at line 776 of file shader.h.

◆ set_uniform() [37/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
T v0 )

Sets the uniform.

Parameters
nameThe uniform name
v0The value

◆ set_uniform() [38/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
T v0,
T v1 )

Sets the uniform.

Parameters
nameThe uniform name
v0The value of the first element
v1The value of the second element

◆ set_uniform() [39/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
T v0,
T v1,
T v2 )

Sets the uniform.

Parameters
nameThe uniform name
v0The value of the first element
v1The value of the second element
v2The value of the third element

◆ set_uniform() [40/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
T v0,
T v1,
T v2,
T v3 )

Sets the uniform.

Parameters
nameThe uniform name
v0The value of the first element
v1The value of the second element
v2The value of the third element
v3The value of the fourth element

◆ set_uniform() [41/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const double * value )
inline

Definition at line 1068 of file shader.h.

◆ set_uniform() [42/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const float * value )
inline

Definition at line 1061 of file shader.h.

◆ set_uniform() [43/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const T * value )

Sets the uniform.

Parameters
nameThe uniform name
countThe number of vectors
columnsThe number of matrix columns
rowsThe number of matrix rows
transposeSpecifies whether to transpose the matrix
valueA pointer to the values

◆ set_uniform() [44/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int elements,
const double * value )
inline

Definition at line 937 of file shader.h.

◆ set_uniform() [45/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int elements,
const float * value )
inline

Definition at line 930 of file shader.h.

◆ set_uniform() [46/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int elements,
const int * value )
inline

Definition at line 916 of file shader.h.

◆ set_uniform() [47/104]

template<typename T>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int elements,
const T * value )

Sets the uniform.

Parameters
nameThe uniform name
countThe number of vectors
elementsThe number of elements per vector
valueA pointer to the values

◆ set_uniform() [48/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int count,
unsigned int elements,
const unsigned int * value )
inline

Definition at line 923 of file shader.h.

◆ set_uniform() [49/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int v0 )
inline

Definition at line 638 of file shader.h.

◆ set_uniform() [50/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int v0,
unsigned int v1 )
inline

Definition at line 686 of file shader.h.

◆ set_uniform() [51/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int v0,
unsigned int v1,
unsigned int v2 )
inline

Definition at line 734 of file shader.h.

◆ set_uniform() [52/104]

template<>
void sgltk::Shader::set_uniform ( const std::string & name,
unsigned int v0,
unsigned int v1,
unsigned int v2,
unsigned int v3 )
inline

Definition at line 782 of file shader.h.

◆ set_uniform() [53/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::dmat2 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 255 of file shader.cpp.

◆ set_uniform() [54/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::dmat3 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 263 of file shader.cpp.

◆ set_uniform() [55/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::dmat4 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 271 of file shader.cpp.

◆ set_uniform() [56/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::mat2 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 251 of file shader.cpp.

◆ set_uniform() [57/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::mat3 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 259 of file shader.cpp.

◆ set_uniform() [58/104]

void Shader::set_uniform ( int location,
bool transpose,
const glm::mat4 & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 267 of file shader.cpp.

◆ set_uniform() [59/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::dmat2 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 372 of file shader.cpp.

◆ set_uniform() [60/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::dmat3 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 386 of file shader.cpp.

◆ set_uniform() [61/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::dmat4 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 400 of file shader.cpp.

◆ set_uniform() [62/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::mat2 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 365 of file shader.cpp.

◆ set_uniform() [63/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::mat3 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 379 of file shader.cpp.

◆ set_uniform() [64/104]

void Shader::set_uniform ( int location,
bool transpose,
const std::vector< glm::mat4 > & value )

Sets the uniform.

Parameters
locationThe uniform location
transposeSpecifies whether to transpose the matrix
valueA reference to the values

Definition at line 393 of file shader.cpp.

◆ set_uniform() [65/104]

void Shader::set_uniform ( int location,
const glm::dvec2 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 207 of file shader.cpp.

◆ set_uniform() [66/104]

void Shader::set_uniform ( int location,
const glm::dvec3 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 215 of file shader.cpp.

◆ set_uniform() [67/104]

void Shader::set_uniform ( int location,
const glm::dvec4 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 223 of file shader.cpp.

◆ set_uniform() [68/104]

void Shader::set_uniform ( int location,
const glm::vec2 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 203 of file shader.cpp.

◆ set_uniform() [69/104]

void Shader::set_uniform ( int location,
const glm::vec3 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 211 of file shader.cpp.

◆ set_uniform() [70/104]

void Shader::set_uniform ( int location,
const glm::vec4 & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 219 of file shader.cpp.

◆ set_uniform() [71/104]

void Shader::set_uniform ( int location,
const std::vector< glm::dvec2 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 315 of file shader.cpp.

◆ set_uniform() [72/104]

void Shader::set_uniform ( int location,
const std::vector< glm::dvec3 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 323 of file shader.cpp.

◆ set_uniform() [73/104]

void Shader::set_uniform ( int location,
const std::vector< glm::dvec4 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 331 of file shader.cpp.

◆ set_uniform() [74/104]

void Shader::set_uniform ( int location,
const std::vector< glm::vec2 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 311 of file shader.cpp.

◆ set_uniform() [75/104]

void Shader::set_uniform ( int location,
const std::vector< glm::vec3 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 319 of file shader.cpp.

◆ set_uniform() [76/104]

void Shader::set_uniform ( int location,
const std::vector< glm::vec4 > & value )

Sets the uniform.

Parameters
locationThe uniform location
valueA reference to the values

Definition at line 327 of file shader.cpp.

◆ set_uniform() [77/104]

template<>
void sgltk::Shader::set_uniform ( int location,
double v0 )
inline

Definition at line 626 of file shader.h.

◆ set_uniform() [78/104]

template<>
void sgltk::Shader::set_uniform ( int location,
double v0,
double v1 )
inline

Definition at line 674 of file shader.h.

◆ set_uniform() [79/104]

template<>
void sgltk::Shader::set_uniform ( int location,
double v0,
double v1,
double v2 )
inline

Definition at line 722 of file shader.h.

◆ set_uniform() [80/104]

template<>
void sgltk::Shader::set_uniform ( int location,
double v0,
double v1,
double v2,
double v3 )
inline

Definition at line 770 of file shader.h.

◆ set_uniform() [81/104]

template<>
void sgltk::Shader::set_uniform ( int location,
float v0 )
inline

Definition at line 620 of file shader.h.

◆ set_uniform() [82/104]

template<>
void sgltk::Shader::set_uniform ( int location,
float v0,
float v1 )
inline

Definition at line 668 of file shader.h.

◆ set_uniform() [83/104]

template<>
void sgltk::Shader::set_uniform ( int location,
float v0,
float v1,
float v2 )
inline

Definition at line 716 of file shader.h.

◆ set_uniform() [84/104]

template<>
void sgltk::Shader::set_uniform ( int location,
float v0,
float v1,
float v2,
float v3 )
inline

Definition at line 764 of file shader.h.

◆ set_uniform() [85/104]

template<>
void sgltk::Shader::set_uniform ( int location,
int v0 )
inline

Definition at line 608 of file shader.h.

◆ set_uniform() [86/104]

template<>
void sgltk::Shader::set_uniform ( int location,
int v0,
int v1 )
inline

Definition at line 656 of file shader.h.

◆ set_uniform() [87/104]

template<>
void sgltk::Shader::set_uniform ( int location,
int v0,
int v1,
int v2 )
inline

Definition at line 704 of file shader.h.

◆ set_uniform() [88/104]

template<>
void sgltk::Shader::set_uniform ( int location,
int v0,
int v1,
int v2,
int v3 )
inline

Definition at line 752 of file shader.h.

◆ set_uniform() [89/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
T v0 )

Sets the uniform.

Parameters
locationThe uniform location
v0The value

◆ set_uniform() [90/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
T v0,
T v1 )

Sets the uniform.

Parameters
locationThe uniform location
v0The value of the first element
v1The value of the second element

◆ set_uniform() [91/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
T v0,
T v1,
T v2 )

Sets the uniform.

Parameters
locationThe uniform location
v0The value of the first element
v1The value of the second element
v2The value of the third element

◆ set_uniform() [92/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
T v0,
T v1,
T v2,
T v3 )

Sets the uniform.

Parameters
locationThe uniform location
v0The value of the first element
v1The value of the second element
v2The value of the third element
v3The value of the fourth element

◆ set_uniform() [93/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const double * value )
inline

Definition at line 1002 of file shader.h.

◆ set_uniform() [94/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const float * value )
inline

Definition at line 944 of file shader.h.

◆ set_uniform() [95/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int columns,
unsigned int rows,
bool transpose,
const T * value )

Sets the uniform.

Parameters
locationThe uniform location
countThe number of vectors
columnsThe number of matrix columns
rowsThe number of matrix rows
transposeSpecifies whether to transpose the matrix
valueA pointer to the values

◆ set_uniform() [96/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int elements,
const double * value )
inline

Definition at line 887 of file shader.h.

◆ set_uniform() [97/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int elements,
const float * value )
inline

Definition at line 858 of file shader.h.

◆ set_uniform() [98/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int elements,
const int * value )
inline

Definition at line 800 of file shader.h.

◆ set_uniform() [99/104]

template<typename T>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int elements,
const T * value )

Sets the uniform.

Parameters
locationThe uniform location
countThe number of vectors
elementsThe number of elements per vector
valueA pointer to the values

◆ set_uniform() [100/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int count,
unsigned int elements,
const unsigned int * value )
inline

Definition at line 829 of file shader.h.

◆ set_uniform() [101/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int v0 )
inline

Definition at line 614 of file shader.h.

◆ set_uniform() [102/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int v0,
unsigned int v1 )
inline

Definition at line 662 of file shader.h.

◆ set_uniform() [103/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int v0,
unsigned int v1,
unsigned int v2 )
inline

Definition at line 710 of file shader.h.

◆ set_uniform() [104/104]

template<>
void sgltk::Shader::set_uniform ( int location,
unsigned int v0,
unsigned int v1,
unsigned int v2,
unsigned int v3 )
inline

Definition at line 758 of file shader.h.

◆ unbind()

void Shader::unbind ( )

Unbinds the shader and restores the previously bound shader.

Definition at line 188 of file shader.cpp.

Member Data Documentation

◆ program

GLuint sgltk::Shader::program

Shader name.

Definition at line 49 of file shader.h.

◆ transform_feedback

bool sgltk::Shader::transform_feedback

True if the shader records values into transform feedback buffer(s)

Definition at line 36 of file shader.h.


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