|
Cutout Vis2012
TUWienVisualisierung2(SS2012)-AdaptiveCutaways
|
#include <Shader.h>
Public Member Functions | |
| Shader (const std::string &name) | |
| bool | attachShaderSource (int type, const std::string &source) |
| bool | attachShaderFile (int type, const std::string &path) |
| bool | compileShaders () |
| bool | link (const std::string &out) |
| bool | link (const std::string *out, int numAttachments) |
| void | bind () |
| void | unbind () |
| GLint | getUniformLocation (const std::string &name) const |
| GLint | getAttribLocation (const std::string &name) const |
| const std::string & | getName () const |
Provides functionality to load GLSL source code from a file, compile it, link it and bind it to the context.
| 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.
| 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 | ( | ) |
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.
| GLint Shader::getUniformLocation | ( | const std::string & | name) | const |
Returns the uniform location name of this shader.
| bool Shader::link | ( | const std::string & | out) |
Links all compiled shaders to form a shader program. out is the only frag data location.
| bool Shader::link | ( | const std::string * | out, |
| int | numAttachments | ||
| ) |
Links all compiled shaders to form a shader program. out is a pointer to the first element in an array of frag data locations. numAttachments is the number of frag data locations.
| void Shader::unbind | ( | ) |
Unbinds the currently bound shader from the context.
1.8.4