45 #ifndef CShaderProgramH
46 #define CShaderProgramH
103 static cShaderProgramPtr
create() {
return (std::make_shared<cShaderProgram>()); }
147 void setUniformi(
const char* a_name,
const GLint a_value);
150 void setUniformf(
const char* a_name,
const GLfloat a_value);
162 void setUniformiv(
const char* a_name,
const GLint *a_values,
const int a_count);
165 void setUniformfv(
const char* a_name,
const GLfloat *a_values,
const int a_count);
This class implements a 3D vector.
Definition: CVector3d.h:85
std::vector< cShaderPtr > m_shaders
List of attached shaders.
Definition: CShaderProgram.h:193
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition: CRenderOptions.h:82
Implements an OpenGL shader primitive.
bool linkProgram()
This method links the shader program and returns the link status.
Definition: CShaderProgram.cpp:112
void setUniform(const char *a_name, cVector3d &a_value)
This method sets a cVector3d uniform to a specified value.
Definition: CShaderProgram.cpp:384
void attachShader(cShaderPtr a_shader)
This method attaches a shader to the shader program.
Definition: CShaderProgram.cpp:95
int getUniformLocation(const char *a_name)
This method returns the location of a specified uniform.
Definition: CShaderProgram.cpp:291
void use(cGenericObject *a_object, cRenderOptions &a_options)
This method enables the shader program.
Definition: CShaderProgram.cpp:196
void setUniformfv(const char *a_name, const GLfloat *a_values, const int a_count)
This method sets a float array uniform to specified values.
Definition: CShaderProgram.cpp:524
bool m_linked
If true then shader program was successfully linked, false otherwise.
Definition: CShaderProgram.h:178
GLint getId()
This method returns the program ID.
Definition: CShaderProgram.h:137
This class implements a shader program primitive.
Definition: CShaderProgram.h:88
GLuint m_id
OpenGL handle ID for the shader program.
Definition: CShaderProgram.h:175
std::shared_ptr< cShader > cShaderPtr
Definition: CShader.h:89
bool m_enabled
If true then program shader is currently enabled.
Definition: CShaderProgram.h:181
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition: CGenericObject.h:112
This class implements a 3D matrix.
Definition: CMatrix3d.h:97
int getAttributeLocation(const char *a_name)
This method returns the location of a specified attribute.
Definition: CShaderProgram.cpp:259
Implements a base class for all objects.
std::map< std::string, int > m_uniformLocList
Map of uniforms and their binding locations.
Definition: CShaderProgram.h:190
static cShaderProgramPtr create()
Shared cShaderProgram allocator.
Definition: CShaderProgram.h:103
GLuint m_shaderCount
Number of shaders that are attached to the shader program.
Definition: CShaderProgram.h:184
virtual ~cShaderProgram()
Destructor of cShaderProgram.
Definition: CShaderProgram.cpp:77
void setUniformiv(const char *a_name, const GLint *a_values, const int a_count)
This method sets an int array uniform to specified values.
Definition: CShaderProgram.cpp:492
bool isUsed()
This method returns true if this shader is currently in use. false otherwise.
Definition: CShaderProgram.h:125
std::shared_ptr< cShaderProgram > cShaderProgramPtr
Definition: CShaderProgram.h:70
cShaderProgram()
Constructor of cShaderProgram.
Definition: CShaderProgram.cpp:61
void bindAttributeLocation(const unsigned int a_index, const char *a_name)
This method binds an attribute to a name.
Definition: CShaderProgram.cpp:231
Definition: CAudioBuffer.cpp:56
void setUniformi(const char *a_name, const GLint a_value)
This method sets an int uniform to a specified value.
Definition: CShaderProgram.cpp:322
std::map< std::string, int > m_attributeLocList
Map of attributes and their binding locations.
Definition: CShaderProgram.h:187
void setUniformf(const char *a_name, const GLfloat a_value)
This method sets a float uniform to a specified value.
Definition: CShaderProgram.cpp:353
void disable()
This method disables the shader program.
Definition: CShaderProgram.cpp:214