Developer Documentation
|
#include <OpenFlipper/libs_required/ACG/ShaderUtils/GLSLShader.hh>
Public Member Functions | |
Program () | |
Creates a new GLSL program object. | |
virtual | ~Program () |
Deletes the GLSL program object and frees the linked shader objects. | |
GLuint | getProgramId () |
Returns opengl id. | |
Compilation/Linking | |
void | attach (PtrConstShader _shader) |
Attaches a shader object to the program object. | |
void | detach (PtrConstShader _shader) |
Detaches a shader object from the program object. | |
void | link () |
Links the shader objects to the program. | |
Localizations | |
int | getAttributeLocation (const char *_name) |
Get location of the specified attribute. More... | |
int | getUniformLocation (const char *_name) |
Get location of the specified uniform. More... | |
int | getFragDataLocation (const char *_name) |
Get location of the fragment data output. More... | |
void | bindAttributeLocation (unsigned int _index, const char *_name) |
Bind attribute to name. More... | |
void | bindFragDataLocation (unsigned int _index, const char *_name) |
Bind fragment output data to name. More... | |
Uniform setters | |
void | setUniform (const char *_name, GLint _value) |
Set int uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec2i &_value) |
Set Vec2i uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec3i &_value) |
Set Vec3i uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec4i &_value) |
Set Vec4i uniform to specified value. More... | |
void | setUniform (const char *_name, GLuint _value) |
Set uint uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec2ui &_value) |
Set Vec2ui uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec3ui &_value) |
Set Vec3ui uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec4ui &_value) |
Set Vec4ui uniform to specified value. More... | |
void | setUniform (const char *_name, GLfloat _value) |
Set float uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec2f &_value) |
Set Vec2f uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec3f &_value) |
Set Vec3f uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec4f &_value) |
Set Vec4f uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false) |
Set 4x4fMatrix uniform to specified value. More... | |
void | setUniformMat3 (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false) |
Set 3x3fMatrix uniform to specified value. More... | |
void | setUniform (const char *_name, const GLint *_values, int _count) |
Set int array uniform to specified values. More... | |
void | setUniform (const char *_name, const GLfloat *_values, int _count) |
Set float array uniform to specified values. More... | |
void | setUniform (const char *_name, const ACG::Vec2f *_values, int _count) |
Set Vec2f array uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec3f *_values, int _count) |
Set Vec3f array uniform to specified value. More... | |
void | setUniform (const char *_name, const ACG::Vec4f *_values, int _count) |
Set Vec4f array uniform to specified value. More... | |
void | setUniform (const char *_name, int _index, bool _value) |
Set an entry of a bool uniform array. More... | |
void | setUniform (const char *_name, int _index, int _value) |
Set an entry of a int uniform array. More... | |
void | setUniform (const char *_name, int _index, float _value) |
Set an entry of a float uniform array. More... | |
Uniform buffer blocks | |
GLuint | getUniformBlockIndex (const char *_name) |
Get location of the specified uniform buffer. More... | |
void | setUniformBlockBinding (GLuint _index, int _binding) |
Set binding point of a uniform buffer. More... | |
void | setUniformBlockBinding (const char *_name, int _binding) |
Set binding point of a uniform buffer. More... | |
int | getUniformBlockSize (GLuint _index) |
Get size in bytes of a uniform buffer. More... | |
int | getUniformBlockSize (const char *_name) |
Get size in bytes of a uniform buffer. More... | |
void | getUniformBlockOffsets (int _numUniforms, const char **_names, int *_outOffsets) |
Get offsets of uniforms in a uniform buffer. More... | |
Geometry shader parameters | |
void | setGeometryInputType (GLint _type) |
Set Type of Geometry. More... | |
void | setGeometryOutputType (GLint _type) |
Set output type of geometry. More... | |
void | setGeometryVertexCount (GLint _numVerticesOut) |
Sets the maximum vertex output of the geometry shader. More... | |
Enable/disable functions | |
void | use () |
Enables the program object for using. | |
void | disable () |
Resets to standard rendering pipeline. | |
bool | isActive () |
Returns if the program object is currently active. | |
bool | isLinked () |
Returns if the program object has been succesfully linked. | |
Private Attributes | |
std::list< PtrConstShader > | m_linkedShaders |
GLint | m_programId |
GLint | m_linkStatus |
GLSL program class.
A GLSL program links together the vertex and fragment shaders.
Definition at line 211 of file GLSLShader.hh.
void GLSL::Program::bindAttributeLocation | ( | unsigned int | _index, |
const char * | _name | ||
) |
Bind attribute to name.
_index | Index of the attribute to be bound |
_name | Name of the attribute |
Definition at line 682 of file GLSLShader.cc.
void GLSL::Program::bindFragDataLocation | ( | unsigned int | _index, |
const char * | _name | ||
) |
Bind fragment output data to name.
_index | Index of the fragment output to be bound |
_name | Name of the fragment output data |
Definition at line 692 of file GLSLShader.cc.
int GLSL::Program::getAttributeLocation | ( | const char * | _name | ) |
Get location of the specified attribute.
_name | Name of the attribute |
Definition at line 702 of file GLSLShader.cc.
int GLSL::Program::getFragDataLocation | ( | const char * | _name | ) |
Get location of the fragment data output.
_name | Name of the fragment data output |
Definition at line 724 of file GLSLShader.cc.
GLuint GLSL::Program::getUniformBlockIndex | ( | const char * | _name | ) |
Get location of the specified uniform buffer.
Program does not have to be active.
_name | name of the uniform block |
Definition at line 767 of file GLSLShader.cc.
void GLSL::Program::getUniformBlockOffsets | ( | int | _numUniforms, |
const char ** | _names, | ||
int * | _outOffsets | ||
) |
Get offsets of uniforms in a uniform buffer.
Program does not have to be active.
_numUniforms | number of uniforms to query offsets for |
_names | array of uniform names in the buffer |
_outOffsets | offset for each uniform |
Definition at line 834 of file GLSLShader.cc.
int GLSL::Program::getUniformBlockSize | ( | GLuint | _index | ) |
Get size in bytes of a uniform buffer.
Program does not have to be active.
_index | block index as returned via getUniformBlockIndex |
Definition at line 807 of file GLSLShader.cc.
int GLSL::Program::getUniformBlockSize | ( | const char * | _name | ) |
Get size in bytes of a uniform buffer.
Program does not have to be active.
_name | name of the uniform block |
Definition at line 822 of file GLSLShader.cc.
int GLSL::Program::getUniformLocation | ( | const char * | _name | ) |
Get location of the specified uniform.
_name | Name of the uniform |
Definition at line 713 of file GLSLShader.cc.
void GLSL::Program::setGeometryInputType | ( | GLint | _type | ) |
Set Type of Geometry.
valid input types: GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT
_type | Geometry type |
Definition at line 736 of file GLSLShader.cc.
void GLSL::Program::setGeometryOutputType | ( | GLint | _type | ) |
Set output type of geometry.
valid output types: GL_POINTS, GL_LINE_STRIP, GL_TRIANGLE_STRIP
_type | Output geometry type |
Definition at line 746 of file GLSLShader.cc.
void GLSL::Program::setGeometryVertexCount | ( | GLint | _numVerticesOut | ) |
Sets the maximum vertex output of the geometry shader.
Query GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT to get the gpu limitation
_numVerticesOut | Maximal number of vertices |
Definition at line 756 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
GLint | _value | ||
) |
Set int uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 385 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec2i & | _value | ||
) |
Set Vec2i uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 398 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec3i & | _value | ||
) |
Set Vec3i uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 411 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec4i & | _value | ||
) |
Set Vec4i uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 424 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
GLuint | _value | ||
) |
Set uint uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 437 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec2ui & | _value | ||
) |
Set Vec2ui uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 450 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec3ui & | _value | ||
) |
Set Vec3ui uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 463 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec4ui & | _value | ||
) |
Set Vec4ui uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 476 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
GLfloat | _value | ||
) |
Set float uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 489 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec2f & | _value | ||
) |
Set Vec2f uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 502 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec3f & | _value | ||
) |
Set Vec3f uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 515 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec4f & | _value | ||
) |
Set Vec4f uniform to specified value.
_name | Name of the uniform |
_value | New value of the uniform |
Definition at line 528 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::GLMatrixf & | _value, | ||
bool | _transposed = false |
||
) |
Set 4x4fMatrix uniform to specified value.
_name | Name of the uniform |
_value | Matrix to be set |
_transposed | Is the matrix transposed? |
Definition at line 649 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const GLint * | _values, | ||
int | _count | ||
) |
Set int array uniform to specified values.
_name | Name of the uniform to be set |
_values | Pointer to an array with the new values |
_count | Number of values in the given array |
Definition at line 542 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const GLfloat * | _values, | ||
int | _count | ||
) |
Set float array uniform to specified values.
_name | Name of the uniform to be set |
_values | Pointer to an array with the new values |
_count | Number of values in the given array |
Definition at line 556 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec2f * | _values, | ||
int | _count | ||
) |
Set Vec2f array uniform to specified value.
_name | Name of the uniform |
_values | Pointer to an array with the new values |
_count | Number of values in the given array |
Definition at line 570 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec3f * | _values, | ||
int | _count | ||
) |
Set Vec3f array uniform to specified value.
_name | Name of the uniform |
_values | Pointer to an array with the new values |
_count | Number of values in the given array |
Definition at line 584 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
const ACG::Vec4f * | _values, | ||
int | _count | ||
) |
Set Vec4f array uniform to specified value.
_name | Name of the uniform |
_values | Pointer to an array with the new values |
_count | Number of values in the given array |
Definition at line 598 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
int | _index, | ||
bool | _value | ||
) |
Set an entry of a bool uniform array.
_name | Name of the uniform to be set |
_index | Entry in the array |
_value | New value of the entry |
Definition at line 612 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
int | _index, | ||
int | _value | ||
) |
Set an entry of a int uniform array.
_name | Name of the uniform to be set |
_index | Entry in the array |
_value | New value of the entry |
Definition at line 624 of file GLSLShader.cc.
void GLSL::Program::setUniform | ( | const char * | _name, |
int | _index, | ||
float | _value | ||
) |
Set an entry of a float uniform array.
_name | Name of the uniform to be set |
_index | Entry in the array |
_value | New value of the entry |
Definition at line 636 of file GLSLShader.cc.
void GLSL::Program::setUniformBlockBinding | ( | GLuint | _index, |
int | _binding | ||
) |
Set binding point of a uniform buffer.
Program does not have to be active.
_index | block index as returned via getUniformBlockIndex |
_binding | binding point where the buffer is bound to |
Definition at line 783 of file GLSLShader.cc.
void GLSL::Program::setUniformBlockBinding | ( | const char * | _name, |
int | _binding | ||
) |
Set binding point of a uniform buffer.
Program does not have to be active.
_name | name of the uniform block |
_binding | binding point where the buffer is bound to |
Definition at line 796 of file GLSLShader.cc.
void GLSL::Program::setUniformMat3 | ( | const char * | _name, |
const ACG::GLMatrixf & | _value, | ||
bool | _transposed = false |
||
) |
Set 3x3fMatrix uniform to specified value.
_name | Name of the uniform |
_value | Matrix to be set |
_transposed | Is the matrix transposed? |
Definition at line 663 of file GLSLShader.cc.