|
| ShaderBase (const std::string &vertexShaderCode, const std::string &fragmentShaderCode, const AttributeSetPtr &attributes, const std::vector< std::string > &uniformNames) |
| Constructs a ShaderBase with the given code for its vertex and fragment shader. More...
|
|
virtual bool | isCurrent () const override |
| Returns whether or not this shader is bound. More...
|
|
virtual bool | isValid () const override |
| Returns whether or not this shader is valid (compiled and linked) and can be used for rendering. More...
|
|
virtual bool | isCompiled () const override |
| Returns whether or not this shader has been processed for compilation. More...
|
|
virtual GLuint | getProgramId () const override |
| Returns the GL program id for this shader. More...
|
|
virtual void | begin () override |
| Binds this shader, compiling if necessary. More...
|
|
virtual void | end () override |
| Unbinds this shader if bound by a corresponding call to begin(). More...
|
|
virtual void | compile () override |
| Compiles this Shader's GLSL code and links it into a GL program. More...
|
|
virtual std::string | getErrorLog () const override |
| Retrieves the string describing compilation errors, if the call to compile() failed and isValid() is false . More...
|
|
void | dispose () |
| Destroys GL resources that were allocated for this ShaderBase. More...
|
|
virtual int | getAttributeLocation (int index) const override |
| Returns the location of an indexed Attribute. More...
|
|
virtual int | getUniformLocation (int index) const override |
| Returns the location of an indexed uniform. More...
|
|
| Shader (const AttributeSetPtr &attributes, const std::vector< std::string > &uniformNames) |
| Construct a Shader with the given list of attributes and uniforms. More...
|
|
const AttributeSetPtr & | getAttributes () const |
| Returns the list of indexed Attributes for this shader, as an AttributeSet. More...
|
|
const std::vector< std::string > & | getUniformNames () const |
| Returns the list of indexed uniforms. More...
|
|
void | setIndexedUniform1f (int index, bool global, float value, float *stateValue) |
| Set the value of a float scalar uniform at the given index . More...
|
|
void | setIndexedUniform2f (int index, bool global, const Vector2 &value, Vector2 *stateValue) |
| Set the value of a 2D float vector uniform at the given index . More...
|
|
void | setIndexedUniform3f (int index, bool global, float value1, float value2, float value3, float *stateValue) |
| Set the value of a 3D float vector uniform at the given index . More...
|
|
void | setIndexedUniform4f (int index, bool global, float value1, float value2, float value3, float value4, float *stateValue) |
| Set the value of a 4D float vector uniform at the given index . More...
|
|
void | setIndexedUniform1i (int index, bool global, int value, int *stateValue) |
| Set the value of an integer scalar uniform at the given index . More...
|
|
void | setIndexedUniformMatrix4f (int index, bool global, bool transpose, const Matrix4 &value, Matrix4 *stateValue) |
| Set the value of a 4x4 float matrix uniform at the given index . More...
|
|
Implementation of Shader which compiles itself from shader code.
Vertex and fragment shader code is passed to ShaderBase's constructor, along with attributes and uniforms (as expected by the base class, Shader). The shader code is stored, and compiled by a call to compile(), or the first time it is selected by a call to begin().
- Note
- This class does not currently restore GL resources on context change.