Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::ShaderProgram Class Reference

Represents an OpenGL shader program composed of multiple shaders. More...

#include <ShaderProgram.h>

Public Member Functions

 ShaderProgram ()
 Constructs an empty ShaderProgram.
 
 ~ShaderProgram ()=default
 Destroys the ShaderProgram.
 
void Unload ()
 Unloads the shader program and releases resources.
 
void Compose (std::vector< Shader * > shaders)
 Composes the shader program from a list of shaders.
 
GLuint GetID () const
 Gets the OpenGL program ID.
 
void Use ()
 Activates the shader program for use.
 
void SetBool (const GLchar *pName, GLboolean pValue)
 Sets a boolean uniform variable.
 
void SetInt (const GLchar *pName, GLint pValue)
 Sets an integer uniform variable.
 
void SetFloat (const GLchar *pName, GLfloat pValue)
 Sets a float uniform variable.
 
void SetVec2f (const GLchar *pName, const Vector2 &pValue)
 Sets a vec2 uniform variable using a Vector2.
 
void SetVec2f (const GLchar *pName, GLfloat pX, GLfloat pY)
 Sets a vec2 uniform variable using two floats.
 
void SetVec3f (const GLchar *pName, const Vector3 &pValue)
 Sets a vec3 uniform variable using a Vector3.
 
void SetVec3f (const GLchar *pName, const Color &pValue)
 Sets a vec3 uniform variable using a Color.
 
void SetVec3f (const GLchar *pName, GLfloat pX, GLfloat pY, GLfloat pZ)
 Sets a vec3 uniform variable using three floats.
 
void SetVec4f (const GLchar *pName, const Vector4 &pValue)
 Sets a vec4 uniform variable using a Vector4.
 
void SetVec4f (const GLchar *pName, const Color &pValue)
 Sets a vec4 uniform variable using a Color.
 
void SetVec4f (const GLchar *pName, GLfloat pX, GLfloat pY, GLfloat pZ, GLfloat pW)
 Sets a vec4 uniform variable using four floats.
 
void SetMat2 (const GLchar *pName, const glm::mat2 &pMatrix)
 Sets a mat2 uniform variable.
 
void SetMat3 (const GLchar *pName, const glm::mat3 &pMatrix)
 Sets a mat3 uniform variable.
 
void SetMat4 (const GLchar *pName, const Matrix4 &pMatrix)
 Sets a mat4 uniform variable using Matrix4.
 
void SetMat4Row (const GLchar *pName, const Matrix4Row &pMatrix)
 Sets a mat4 uniform variable using Matrix4Row.
 

Detailed Description

Represents an OpenGL shader program composed of multiple shaders.

Provides methods to compose, use, and set uniform variables for the shader program.

Member Function Documentation

◆ Compose()

void ShaderProgram::Compose ( std::vector< Shader * > shaders)

Composes the shader program from a list of shaders.

Parameters
shadersVector of pointers to Shader objects.

◆ GetID()

GLuint clt::ShaderProgram::GetID ( ) const
inline

Gets the OpenGL program ID.

Returns
GLuint Program ID.

◆ SetBool()

void ShaderProgram::SetBool ( const GLchar * pName,
GLboolean pValue )

Sets a boolean uniform variable.

Parameters
pNameName of the uniform variable.
pValueBoolean value to set.

◆ SetFloat()

void ShaderProgram::SetFloat ( const GLchar * pName,
GLfloat pValue )

Sets a float uniform variable.

Parameters
pNameName of the uniform variable.
pValueFloat value to set.

◆ SetInt()

void ShaderProgram::SetInt ( const GLchar * pName,
GLint pValue )

Sets an integer uniform variable.

Parameters
pNameName of the uniform variable.
pValueInteger value to set.

◆ SetMat2()

void ShaderProgram::SetMat2 ( const GLchar * pName,
const glm::mat2 & pMatrix )

Sets a mat2 uniform variable.

Parameters
pNameName of the uniform variable.
pMatrix2x2 matrix value to set.

◆ SetMat3()

void ShaderProgram::SetMat3 ( const GLchar * pName,
const glm::mat3 & pMatrix )

Sets a mat3 uniform variable.

Parameters
pNameName of the uniform variable.
pMatrix3x3 matrix value to set.

◆ SetMat4()

void ShaderProgram::SetMat4 ( const GLchar * pName,
const Matrix4 & pMatrix )

Sets a mat4 uniform variable using Matrix4.

Parameters
pNameName of the uniform variable.
pMatrix4x4 matrix value to set.

◆ SetMat4Row()

void ShaderProgram::SetMat4Row ( const GLchar * pName,
const Matrix4Row & pMatrix )

Sets a mat4 uniform variable using Matrix4Row.

Parameters
pNameName of the uniform variable.
pMatrix4x4 row-major matrix value to set.

◆ SetVec2f() [1/2]

void ShaderProgram::SetVec2f ( const GLchar * pName,
const Vector2 & pValue )

Sets a vec2 uniform variable using a Vector2.

Parameters
pNameName of the uniform variable.
pValueVector2 value to set.

◆ SetVec2f() [2/2]

void ShaderProgram::SetVec2f ( const GLchar * pName,
GLfloat pX,
GLfloat pY )

Sets a vec2 uniform variable using two floats.

Parameters
pNameName of the uniform variable.
pXX component.
pYY component.

◆ SetVec3f() [1/3]

void ShaderProgram::SetVec3f ( const GLchar * pName,
const Color & pValue )

Sets a vec3 uniform variable using a Color.

Parameters
pNameName of the uniform variable.
pValueColor value to set.

◆ SetVec3f() [2/3]

void ShaderProgram::SetVec3f ( const GLchar * pName,
const Vector3 & pValue )

Sets a vec3 uniform variable using a Vector3.

Parameters
pNameName of the uniform variable.
pValueVector3 value to set.

◆ SetVec3f() [3/3]

void ShaderProgram::SetVec3f ( const GLchar * pName,
GLfloat pX,
GLfloat pY,
GLfloat pZ )

Sets a vec3 uniform variable using three floats.

Parameters
pNameName of the uniform variable.
pXX component.
pYY component.
pZZ component.

◆ SetVec4f() [1/3]

void ShaderProgram::SetVec4f ( const GLchar * pName,
const Color & pValue )

Sets a vec4 uniform variable using a Color.

Parameters
pNameName of the uniform variable.
pValueColor value to set.

◆ SetVec4f() [2/3]

void ShaderProgram::SetVec4f ( const GLchar * pName,
const Vector4 & pValue )

Sets a vec4 uniform variable using a Vector4.

Parameters
pNameName of the uniform variable.
pValueVector4 value to set.

◆ SetVec4f() [3/3]

void ShaderProgram::SetVec4f ( const GLchar * pName,
GLfloat pX,
GLfloat pY,
GLfloat pZ,
GLfloat pW )

Sets a vec4 uniform variable using four floats.

Parameters
pNameName of the uniform variable.
pXX component.
pYY component.
pZZ component.
pWW component.

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