This class implements a shader program primitive. More...
#include <CShaderProgram.h>
Public Member Functions | |
| cShaderProgram () | |
| Constructor of cShaderProgram. More... | |
| cShaderProgram (const std::string &a_vertexShader, const std::string &a_fragmentShader) | |
| Constructor of cShaderProgram. More... | |
| virtual | ~cShaderProgram () |
| Destructor of cShaderProgram. More... | |
| void | attachShader (cShaderPtr a_shader) |
| This method attaches a shader to the shader program. More... | |
| bool | linkProgram () |
| This method links the shader program and returns the link status. More... | |
| void | use (cGenericObject *a_object, cRenderOptions &a_options) |
| This method enables the shader program. More... | |
| void | disable () |
| This method disables the shader program. More... | |
| bool | isUsed () |
| This method returns true if this shader is currently in use. false otherwise. More... | |
| void | bindAttributeLocation (const unsigned int a_index, const char *a_name) |
| This method binds an attribute to a name. More... | |
| int | getAttributeLocation (const char *a_name) |
| This method returns the location of a specified attribute. More... | |
| int | getUniformLocation (const char *a_name) |
| This method returns the location of a specified uniform. More... | |
| GLint | getId () |
| This method returns the program ID. More... | |
| void | setGeometryInputType (GLenum a_type) |
| Set the geometry shader input primitype type. More... | |
| void | setGeometryOutputType (GLenum a_type) |
| Set the geometry shader output primitype type. More... | |
| void | setGeometryVerticesOut (int a_numVertices) |
| Set the maximum number of vertices emitted by the gemoetry shader. More... | |
| void | setUniformi (const char *a_name, const GLint a_value) |
| This method sets an int uniform to a specified value. More... | |
| void | setUniformf (const char *a_name, const GLfloat a_value) |
| This method sets a float uniform to a specified value. More... | |
| void | setUniform (const char *a_name, cVector3d &a_value) |
| This method sets a cVector3d uniform to a specified value. More... | |
| void | setUniform (const char *a_name, cMatrix3d &a_value, bool a_transposed) |
| This method sets a cMatrix3d uniform to a specified value. More... | |
| void | setUniform (const char *a_name, cTransform &a_value, bool a_transposed) |
| This method sets a cTransform uniform to a specified value. More... | |
| void | setUniformiv (const char *a_name, const GLint *a_values, const int a_count) |
| This method sets an int array uniform to specified values. More... | |
| void | setUniformfv (const char *a_name, const GLfloat *a_values, const int a_count) |
| This method sets a float array uniform to specified values. More... | |
Static Public Member Functions | |
| static cShaderProgramPtr | create () |
| Shared cShaderProgram allocator. More... | |
| static cShaderProgramPtr | create (const std::string &a_vertexShader, const std::string &a_fragmentShader) |
| Shared cShaderProgram allocator. More... | |
Protected Attributes | |
| GLuint | m_id |
| OpenGL handle ID for the shader program. More... | |
| bool | m_linked |
| If true then shader program was successfully linked, false otherwise. More... | |
| bool | m_enabled |
| If true then program shader is currently enabled. More... | |
| GLuint | m_shaderCount |
| Number of shaders that are attached to the shader program. More... | |
| std::map< std::string, int > | m_attributeLocList |
| Map of attributes and their binding locations. More... | |
| std::map< std::string, int > | m_uniformLocList |
| Map of uniforms and their binding locations. More... | |
| std::vector< cShaderPtr > | m_shaders |
| List of attached shaders. More... | |
| bool | m_geometryShaderAttached |
| Whether or not this program has a geometry shader attached. More... | |
| GLenum | m_geometryInputType |
| Geometry shader input primitive type, if applicable. More... | |
| GLenum | m_geometryOutputType |
| Geometry shader output primitive type, if applicable. More... | |
| GLint | m_geometryVerticesOut |
| Maximum number of vertices generated by the geometry shader. More... | |
This class implements a shader program that contain a list of shader primitives. Shader programs can be assigned to cGenericObject entities to control their graphical output.
| chai3d::cShaderProgram::cShaderProgram | ( | ) |
Constructor of cShaderProgram.
| chai3d::cShaderProgram::cShaderProgram | ( | const std::string & | a_vertexShader, |
| const std::string & | a_fragmentShader | ||
| ) |
Constructor of cShaderProgram.
| a_vertexShader | Vertex shader code. |
| a_vertexShader | Fragment shader code. |
|
virtual |
Destructor of cShaderProgram.
|
inlinestatic |
|
inlinestatic |
| void chai3d::cShaderProgram::attachShader | ( | cShaderPtr | a_shader | ) |
This method attaches a shader to the shader program.
| a_shader | Shader object. |
| bool chai3d::cShaderProgram::linkProgram | ( | ) |
This method links the shader program and return the link status.
| void chai3d::cShaderProgram::use | ( | cGenericObject * | a_object, |
| cRenderOptions & | a_options | ||
| ) |
This method enables the shader program.
| a_object | Object on which the program shader will apply |
| a_options | Rendering options. |
| void chai3d::cShaderProgram::disable | ( | ) |
This method disables the shader program.
|
inline |
| void chai3d::cShaderProgram::bindAttributeLocation | ( | const unsigned int | a_index, |
| const char * | a_name | ||
| ) |
This method binds an attribute to a name.
| a_index | Index of the attribute to be bound |
| a_name | Name of the attribute. |
| int chai3d::cShaderProgram::getAttributeLocation | ( | const char * | a_name | ) |
This method returns the location of a specified attribute.
| a_name | Name of the attribute. |
| int chai3d::cShaderProgram::getUniformLocation | ( | const char * | a_name | ) |
This method returns the location of a specified uniform.
| a_name | Name of the uniform. |
|
inline |
|
inline |
|
inline |
|
inline |
| void chai3d::cShaderProgram::setUniformi | ( | const char * | a_name, |
| const GLint | a_value | ||
| ) |
This method sets an int uniform to a specified value.
| a_name | Name of the uniform. |
| a_value | New value of the uniform. |
| void chai3d::cShaderProgram::setUniformf | ( | const char * | a_name, |
| const GLfloat | a_value | ||
| ) |
This method sets a float uniform to a specified value.
| a_name | Name of the uniform. |
| a_value | New value of the uniform. |
| void chai3d::cShaderProgram::setUniform | ( | const char * | a_name, |
| cVector3d & | a_value | ||
| ) |
This method sets a cVector3d uniform to a specified value.
| a_name | Name of the uniform. |
| a_value | New value of the uniform. |
| void chai3d::cShaderProgram::setUniform | ( | const char * | a_name, |
| cMatrix3d & | a_value, | ||
| bool | a_transposed | ||
| ) |
This method sets a cMatrix3d uniform to a specified value.
| a_name | Name of the uniform. |
| a_value | New 3x3 matrix of the uniform. |
| a_transposed | Is the matrix transposed? |
| void chai3d::cShaderProgram::setUniform | ( | const char * | a_name, |
| cTransform & | a_value, | ||
| bool | a_transposed | ||
| ) |
This method sets a cTransform uniform to a specified value.
| a_name | Name of the uniform. |
| a_value | New 4x4 matrix of the uniform. |
| a_transposed | Is the matrix transposed? |
| void chai3d::cShaderProgram::setUniformiv | ( | const char * | a_name, |
| const GLint * | a_values, | ||
| const int | a_count | ||
| ) |
This method sets an int array uniform to specified values.
| a_name | Name of the uniform. |
| a_values | Pointer to an array with the new values. |
| a_count | Number of values in the given array. |
| void chai3d::cShaderProgram::setUniformfv | ( | const char * | a_name, |
| const GLfloat * | a_values, | ||
| const int | a_count | ||
| ) |
This method sets a float array uniform to specified values.
| a_name | Name of the uniform. |
| a_values | Pointer to an array with the new values. |
| a_count | Number of values in the given array. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |