Shader::Shader |
( |
const std::string & |
name | ) |
|
Creates a shader with an associated name. Name will be displayed to link error message to it.
bool Shader::attachShaderFile |
( |
int |
type, |
|
|
const std::string & |
path |
|
) |
| |
Attaches source code from a file to this shader. Shader type is one of GL_VERTEX_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER.
- Parameters
-
path | file relative to the folder shaders/ |
bool Shader::attachShaderSource |
( |
int |
type, |
|
|
const std::string & |
source |
|
) |
| |
Attaches source code from a string to this shader. Shader type is one of GL_VERTEX_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER.
void Shader::bind |
( |
| ) |
const |
Binds the shader to the context.
bool Shader::compileShaders |
( |
| ) |
|
Attempt to compile all source code attached to this object. Error messages are displayed at the standard output.
GLint Shader::getAttribLocation |
( |
const std::string & |
name | ) |
const |
Returns the generic vertex attribute location name
of this shader.
GLuint Shader::getSubroutineIndex |
( |
GLenum |
shaderType, |
|
|
const std::string & |
name |
|
) |
| |
Returns the index of a subroutine in a specific shader stage
- Parameters
-
shaderType | shader stage of the uniform (GL_VERTEX_SHADER, GL_GEOMETRY_SHADER or GL_FRAGMENT_SHADER) |
name | name of the subroutine |
GLint Shader::getSubroutineUniformLocation |
( |
GLenum |
shaderType, |
|
|
const std::string & |
name |
|
) |
| |
Returns the location of a subroutine uniform in a specific shader stage.
- Parameters
-
shaderType | shader stage of the uniform (GL_VERTEX_SHADER, GL_GEOMETRY_SHADER or GL_FRAGMENT_SHADER) |
name | name of the subroutine uniform |
GLint Shader::getUniformLocation |
( |
const std::string & |
name | ) |
const |
Returns the uniform location name
of this shader.
Links all compiled shaders to form a shader program. Color output locations and indices are defined in the shader.
bool Shader::link |
( |
const std::string & |
out | ) |
|
Links all compiled shaders to form a shader program. out
will be bound to location 0, other bindings are unmodified.
bool Shader::link |
( |
int |
numLocations, |
|
|
const std::string * |
out |
|
) |
| |
Links all compiled shaders to form a shader program and sets color outputs explicitly. Bindings of color outputs that are not mentioned are unmodified.
- Parameters
-
out | pointer to the first element in an array of frag data locations |
numAttachments | number of frag data locations. |
void Shader::setTransformFeedbackVaryings |
( |
int |
numVaryings, |
|
|
const GLchar ** |
varyings, |
|
|
GLenum |
mode |
|
) |
| |
Sets the varyings that shall be recorded during transform feedback. If numVaryings is 0, the transform feedback varyings are removed.
- Parameters
-
numVaryings | number of attributes to be recorded |
varyings | array of the attributes' names |
name | GL_INTERLEAVED_ATTRIBS or GL_SEPARATE_ATTRIBS |
void Shader::unbind |
( |
| ) |
const |
Unbinds the currently bound shader from the context.
The documentation for this class was generated from the following files: