|
KGLLib
|
#include <shader.h>
Public Member Functions | |
| Shader (GLenum type) | |
| Shader (GLenum type, const QString &filename) | |
| virtual | ~Shader () |
| void | setSource (const QString &source) |
| void | setSource (const QByteArray &source) |
| bool | compile () |
| bool | isValid () const |
| bool | isCompiled () const |
| char * | compileLog () const |
| GLenum | type () const |
| GLuint | glId () const |
Protected Member Functions | |
| void | init (GLenum type) |
Protected Attributes | |
| GLuint | mGLId |
| GLenum | mType |
| bool | mValid |
| bool | mCompiled |
| char * | mCompileLog |
Shader class.
Encapsulates a shader object. Note that shaders are only intermediate objects used to create Program objects. For simple use cases, you can use Program class which can automatically create and use necessary Shader objects.
| KGLLib::Shader::Shader | ( | GLenum | type | ) |
Creates a shader of given type. You need to manually call setSource() and compile() before the shader can be added to a Program.
| KGLLib::Shader::Shader | ( | GLenum | type, |
| const QString & | filename | ||
| ) |
Loads shader of given type from given file. Loaded shader is automatically compiled, so if the compilation succeeds, you can add it to a Program object.
References compile(), and setSource().
| KGLLib::Shader::~Shader | ( | ) | [virtual] |
Deletes a shader. Shaders can be deleted after they are added to a Program and the program is linked.
| bool KGLLib::Shader::compile | ( | ) |
Compiles the shader. If compilation succeeds, you can add it to a Program object. If compilation fails, you can see the error using compileLog() method.
Referenced by Shader().
| char* KGLLib::Shader::compileLog | ( | ) | const [inline] |
| void KGLLib::Shader::setSource | ( | const QString & | source | ) |
Sets shader source to source. Next you will need to compile the shader.
Referenced by Shader().
1.7.4