Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
BIAS::glfShaderProgram Class Reference

A shader program composed of several shaders. More...

#include <OpenGLFramework/Base/glfShaderProgram.hh>

Public Member Functions

void AttachShader (const glfShader &shader)
 Attaches a shader to the program. More...
 
void AttachShaderFromFile (GLenum type, const std::string &fileName)
 Attaches a shader to the program, without the need to create an instance of the glfShader class. More...
 
void AttachShaderFromSource (GLenum type, const std::string &sourceCode)
 Attaches a shader to the program, without the need to create an instance of the glfShader class. More...
 
void Bind () const
 Binds the shader program. More...
 
void Create ()
 Creates the shader program. More...
 
std::string GetInfoLog () const
 Returns the info log containing information about the linking of the shader program. More...
 
GLuint GetProgramId ()
 
GLint GetUniformLocation (const std::string &varName)
 
 glfShaderProgram ()
 
void Link ()
 Links the attached shaders. More...
 
 ~glfShaderProgram ()
 
Methods to set uniform parameters.
Note
All double parameters are converted to floats, because OpenGL supports only float uniforms.
Attention
Program has to be linked successfully.
void SetUniform (const std::string &varName, float value)
 
void SetUniform (const std::string &varName, double value)
 
void SetUniform (const std::string &varName, int value)
 
void SetUniform (const std::string &varName, bool value)
 
void SetUniform (const std::string &varName, int count, int *value)
 
void SetUniform (const std::string &varName, int count, float *value)
 
void SetUniform (const std::string &varName, const BIAS::Vector< float > &v)
 
void SetUniform (const std::string &varName, const BIAS::Vector< double > &v)
 
void SetUniform (const std::string &varName, const BIAS::Vector< int > &v)
 
void SetUniform (const std::string &varName, const BIAS::Matrix< float > &m)
 
void SetUniform (const std::string &varName, const BIAS::Matrix< double > &m)
 
void SetUniform (const std::string &varName, const glfMatrix &m)
 
void AutoSetSamplerUniforms ()
 Finds all sampler uniforms and automatically assigns them texture unit indices. More...
 

Static Public Member Functions

static int GetMaxCombinedTextureUnits ()
 

Detailed Description

A shader program composed of several shaders.

Author
jkollmann

Definition at line 40 of file glfShaderProgram.hh.

Constructor & Destructor Documentation

glfShaderProgram::glfShaderProgram ( )

Definition at line 32 of file glfShaderProgram.cpp.

glfShaderProgram::~glfShaderProgram ( )

Definition at line 37 of file glfShaderProgram.cpp.

Member Function Documentation

void glfShaderProgram::AttachShader ( const glfShader shader)
void glfShaderProgram::AttachShaderFromFile ( GLenum  type,
const std::string &  fileName 
)

Attaches a shader to the program, without the need to create an instance of the glfShader class.

The source code of the shader is loaded from a file.

Parameters
typeEither GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
fileNameName of file to load the GLSL source from.

Definition at line 128 of file glfShaderProgram.cpp.

References BIAS::glfShader::CreateFromFile().

void glfShaderProgram::AttachShaderFromSource ( GLenum  type,
const std::string &  sourceCode 
)

Attaches a shader to the program, without the need to create an instance of the glfShader class.

Parameters
typeEither GL_VERTEX_SHADER or GL_FRAGMENT_SHADER.
sourceCodeThe GLSL source code.

Definition at line 116 of file glfShaderProgram.cpp.

References BIAS::glfShader::Create().

void glfShaderProgram::AutoSetSamplerUniforms ( )

Finds all sampler uniforms and automatically assigns them texture unit indices.

Definition at line 457 of file glfShaderProgram.cpp.

void glfShaderProgram::Bind ( ) const
void glfShaderProgram::Create ( )
string glfShaderProgram::GetInfoLog ( ) const

Returns the info log containing information about the linking of the shader program.

Note
If linking the shader programs fails, the info log is also contained in the message of the thrown exception.

Definition at line 155 of file glfShaderProgram.cpp.

Referenced by BIAS::PMDWarp::ExecuteLinearHypothesesAssignment().

int glfShaderProgram::GetMaxCombinedTextureUnits ( )
static

Definition at line 513 of file glfShaderProgram.cpp.

GLuint BIAS::glfShaderProgram::GetProgramId ( )
inline
GLint glfShaderProgram::GetUniformLocation ( const std::string &  varName)
void glfShaderProgram::Link ( )
void glfShaderProgram::SetUniform ( const std::string &  varName,
float  value 
)
void glfShaderProgram::SetUniform ( const std::string &  varName,
double  value 
)

Definition at line 206 of file glfShaderProgram.cpp.

void glfShaderProgram::SetUniform ( const std::string &  varName,
int  value 
)

Definition at line 212 of file glfShaderProgram.cpp.

References BIAS::glfException::GetMessageString().

void glfShaderProgram::SetUniform ( const std::string &  varName,
bool  value 
)

Definition at line 172 of file glfShaderProgram.cpp.

References BIAS::glfException::GetMessageString().

void glfShaderProgram::SetUniform ( const std::string &  varName,
int  count,
int *  value 
)

Definition at line 228 of file glfShaderProgram.cpp.

References BIAS::glfException::GetMessageString().

void glfShaderProgram::SetUniform ( const std::string &  varName,
int  count,
float *  value 
)

Definition at line 243 of file glfShaderProgram.cpp.

References BIAS::glfException::GetMessageString().

void glfShaderProgram::SetUniform ( const std::string &  varName,
const BIAS::Vector< float > &  v 
)
void glfShaderProgram::SetUniform ( const std::string &  varName,
const BIAS::Vector< double > &  v 
)

Definition at line 288 of file glfShaderProgram.cpp.

void glfShaderProgram::SetUniform ( const std::string &  varName,
const BIAS::Vector< int > &  v 
)
void glfShaderProgram::SetUniform ( const std::string &  varName,
const BIAS::Matrix< float > &  m 
)
void glfShaderProgram::SetUniform ( const std::string &  varName,
const BIAS::Matrix< double > &  m 
)

Definition at line 400 of file glfShaderProgram.cpp.

void glfShaderProgram::SetUniform ( const std::string &  varName,
const glfMatrix m 
)

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