Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GLSL::Program Class Reference

GLSL program class. More...

#include <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.
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.
int getUniformLocation (const char *_name)
 Get location of the specified uniform.
void bindAttributeLocation (unsigned int _index, const char *_name)
 Bind attribute to name.
Uniform setters
void setUniform (const char *_name, GLint _value)
 Set int uniform to specified value.
void setUniform (const char *_name, GLfloat _value)
 Set float uniform to specified value.
void setUniform (const char *_name, const ACG::Vec2f &_value)
 Set Vec2f uniform to specified value.
void setUniform (const char *_name, const ACG::Vec3f &_value)
 Set int uniform to specified value.
void setUniform (const char *_name, const ACG::Vec4f &_value)
 Set int uniform to specified value.
void setUniform (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false)
 Set 4x4fMatrix uniform to specified value.
void setUniformMat3 (const char *_name, const ACG::GLMatrixf &_value, bool _transposed=false)
 Set 3x3fMatrix uniform to specified value.
void setUniform (const char *_name, GLint *_values, int _count)
 Set int array uniform to specified values.
void setUniform (const char *_name, GLfloat *_values, int _count)
 Set float array uniform to specified values.
void setUniform (const char *_name, int _index, bool _value)
 Set an entry of a bool uniform array.
void setUniform (const char *_name, int _index, int _value)
 Set an entry of a int uniform array.
void setUniform (const char *_name, int _index, float _value)
 Set an entry of a float uniform array.
Geometry shader parameters
void setGeometryInputType (GLint _type)
 Set Type of Geometry.
void setGeometryOutputType (GLint _type)
 Set output type of geometry.
void setGeometryVertexCount (GLint _numVerticesOut)
 Sets the maximum vertex output of the geometry shader.
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.

Private Attributes

std::list< PtrConstShaderm_linkedShaders
GLint m_programId

Detailed Description

GLSL program class.

A GLSL program links together the vertex and fragment shaders.

Definition at line 138 of file GLSLShader.hh.

Member Function Documentation

void GLSL::Program::bindAttributeLocation ( unsigned int  _index,
const char *  _name 
)

Bind attribute to name.

Parameters
_indexIndex of the attribute to be bound
_nameName of the attribute

Definition at line 454 of file GLSLShader.cc.

int GLSL::Program::getAttributeLocation ( const char *  _name)

Get location of the specified attribute.

Parameters
_nameName of the attribute
Returns
Attribute location

Definition at line 464 of file GLSLShader.cc.

int GLSL::Program::getUniformLocation ( const char *  _name)

Get location of the specified uniform.

Parameters
_nameName of the uniform
Returns
Attribute uniform

Definition at line 475 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

Parameters
_typeGeometry type

Definition at line 487 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

Parameters
_typeOutput geometry type

Definition at line 497 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

Parameters
_numVerticesOutMaximal number of vertices

Definition at line 507 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
GLint  _value 
)

Set int uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 290 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
GLfloat  _value 
)

Set float uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 303 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
const ACG::Vec2f _value 
)

Set Vec2f uniform to specified value.

Set Vec4f uniform to specified value.

Set Vec3f uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform

Definition at line 316 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
const ACG::Vec3f _value 
)

Set int uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform
void GLSL::Program::setUniform ( const char *  _name,
const ACG::Vec4f _value 
)

Set int uniform to specified value.

Parameters
_nameName of the uniform
_valueNew value of the uniform
void GLSL::Program::setUniform ( const char *  _name,
const ACG::GLMatrixf _value,
bool  _transposed = false 
)

Set 4x4fMatrix uniform to specified value.

Parameters
_nameName of the uniform
_valueMatrix to be set
_transposedIs the matrix transposed?

Definition at line 421 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
GLint *  _values,
int  _count 
)

Set int array uniform to specified values.

Parameters
_nameName of the uniform to be set
_valuesPointer to an array with the new values
_countNumber of values in the given array

Definition at line 356 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
GLfloat *  _values,
int  _count 
)

Set float array uniform to specified values.

Parameters
_nameName of the uniform to be set
_valuesPointer to an array with the new values
_countNumber of values in the given array

Definition at line 370 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
int  _index,
bool  _value 
)

Set an entry of a bool uniform array.

Parameters
_nameName of the uniform to be set
_indexEntry in the array
_valueNew value of the entry

Definition at line 384 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
int  _index,
int  _value 
)

Set an entry of a int uniform array.

Parameters
_nameName of the uniform to be set
_indexEntry in the array
_valueNew value of the entry

Definition at line 396 of file GLSLShader.cc.

void GLSL::Program::setUniform ( const char *  _name,
int  _index,
float  _value 
)

Set an entry of a float uniform array.

Parameters
_nameName of the uniform to be set
_indexEntry in the array
_valueNew value of the entry

Definition at line 408 of file GLSLShader.cc.

void GLSL::Program::setUniformMat3 ( const char *  _name,
const ACG::GLMatrixf _value,
bool  _transposed = false 
)

Set 3x3fMatrix uniform to specified value.

Parameters
_nameName of the uniform
_valueMatrix to be set
_transposedIs the matrix transposed?

Definition at line 435 of file GLSLShader.cc.


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