Basic Image AlgorithmS Library
2.8.0
|
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. | |
| |
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 () |
A shader program composed of several shaders.
Definition at line 40 of file glfShaderProgram.hh.
glfShaderProgram::glfShaderProgram | ( | ) |
Definition at line 32 of file glfShaderProgram.cpp.
glfShaderProgram::~glfShaderProgram | ( | ) |
Definition at line 37 of file glfShaderProgram.cpp.
void glfShaderProgram::AttachShader | ( | const glfShader & | shader | ) |
Attaches a shader to the program.
Must be called after glfShaderProgram::Create and before glfShaderProgram::Link.
Definition at line 83 of file glfShaderProgram.cpp.
References BIAS::glfShader::GetShaderID().
Referenced by BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::InitShaders_(), BIAS::TemplateSpecializedBatch::InitShaders_(), and BIAS::PMDWarp::SetupShadersDefault_().
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.
type | Either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. |
fileName | Name 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.
type | Either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. |
sourceCode | The 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 |
Binds the shader program.
Definition at line 430 of file glfShaderProgram.cpp.
Referenced by BIAS::ShaderProgramPool::BindShaderProgram(), BIAS::OutputLensDistortion::Draw_(), and BIAS::TriangleMeshSplatRendering::Splat().
void glfShaderProgram::Create | ( | ) |
Creates the shader program.
After this, you can attach shaders.
Definition at line 71 of file glfShaderProgram.cpp.
Referenced by BIAS::ShaderProgramPool::AddShaderProgram(), BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::InitShaders_(), and BIAS::TemplateSpecializedBatch::InitShaders_().
string glfShaderProgram::GetInfoLog | ( | ) | const |
Returns the info log containing information about the linking of the shader program.
Definition at line 155 of file glfShaderProgram.cpp.
Referenced by BIAS::PMDWarp::ExecuteLinearHypothesesAssignment().
|
static |
Definition at line 513 of file glfShaderProgram.cpp.
|
inline |
Definition at line 129 of file glfShaderProgram.hh.
Referenced by BIAS::SamplerBinding::Bind(), BIAS::SamplerBinding::Cache(), and BIAS::PMDWarp::SetupShadersDefault_().
GLint glfShaderProgram::GetUniformLocation | ( | const std::string & | varName | ) |
Definition at line 497 of file glfShaderProgram.cpp.
Referenced by BIAS::SamplerBinding::Bind(), and BIAS::SamplerBinding::Cache().
void glfShaderProgram::Link | ( | ) |
Links the attached shaders.
After this, the shader program can be used for rendering.
Definition at line 137 of file glfShaderProgram.cpp.
Referenced by BIAS::PMDWarp::ExecuteLinearHypothesesAssignment(), BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::Init_(), BIAS::TemplateSpecializedBatch::InitShaders_(), BIAS::PMDWarp::SetupShadersDefault_(), and BIAS::PMDWarp::SetupShadersProjectiveTexturing_().
void glfShaderProgram::SetUniform | ( | const std::string & | varName, |
float | value | ||
) |
Definition at line 190 of file glfShaderProgram.cpp.
References BIAS::glfException::GetMessageString().
Referenced by BIAS::SeparableBilateralFilter::Draw(), BIAS::OutputWowDisplay2::Draw_(), BIAS::OutputWowDisplay::Draw_(), BIAS::OutputLensDistortion::Draw_(), BIAS::OutputUnderwater::Draw_(), BIAS::PlainPerPixelProcessing::Execute(), BIAS::PMDWarp::ExecuteLinearHypothesesAssignment(), BIAS::DistortionRendering::Init(), BIAS::PlainPerPixelProcessing::Init_(), BIAS::TemplateSpecializedBatch::InitShaders_(), BIAS::SeparableBilateralFilter::SetColorAndSourceAndDest(), BIAS::PMDWarp::SetDispForDistanceAndScale(), BIAS::ShaderProgramPool::SetUniform(), BIAS::ShaderProgramPool::SetUniformArray(), BIAS::PMDWarp::SetupShadersDefault_(), BIAS::PMDWarp::SetupShadersProjectiveTexturing_(), and BIAS::TriangleMeshSplatRendering::Splat().
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 | ||
) |
Definition at line 258 of file glfShaderProgram.cpp.
References BIAS::Vector< T >::GetData(), and BIAS::Vector< T >::GetNumElements().
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 | ||
) |
Definition at line 300 of file glfShaderProgram.cpp.
References BIAS::Vector< T >::GetData(), BIAS::glfException::GetMessageString(), and BIAS::Vector< T >::GetNumElements().
void glfShaderProgram::SetUniform | ( | const std::string & | varName, |
const BIAS::Matrix< float > & | m | ||
) |
Definition at line 335 of file glfShaderProgram.cpp.
References BIAS::Matrix< T >::GetCols(), BIAS::Matrix< T >::GetData(), BIAS::glfException::GetMessageString(), BIAS::Matrix< T >::GetRows(), and BIAS::Matrix< T >::Transpose().
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 | ||
) |
Definition at line 415 of file glfShaderProgram.cpp.
References BIAS::glfMatrix::GetArray(), and BIAS::glfException::GetMessageString().