![]() |
VR-Forces 4.8 Class Documentation
|
A convenience class to represent an OpenGL Shader. More...
Public Types | |
| enum | DtGlShaderType { VERTEX_SHADER = 0, TESSEVAL_SHADER, TESSCONTROL_SHADER, GEOMETRY_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER } |
Public Member Functions | |
| DtGlShader (const std::string &name, const std::string &source, DtGlShaderType type) | |
| create a shader with a given name, from a string source of the given shader type More... | |
| virtual | ~DtGlShader () |
| destroy the shader More... | |
| virtual bool | isValid () const |
| a valid shader is one that is compiled without error and is ready to use in an OpenGL program More... | |
| virtual unsigned int | id () const |
| the OpenGL ID of the internal OpenGL shader More... | |
Static Public Member Functions | |
| static std::string | loadShaderSource (const std::string &strFileName) |
| static API functions More... | |
| static void | saveShaderSource (const std::string &strFileName, const std::string &strSource) |
| Saves shader source code to a file. More... | |
| static std::string | fixVersionDirective (const std::string &shaderString) |
| Moves the #version directive to the top of the shader string to prevent shader compilation errors. More... | |
| static void | deleteShaders (const std::vector< unsigned int > &shaderVector) |
| Loop over the OpenGL shader ids in the shaderVector and deletes them from OpenGL. More... | |
| static bool | compileShader (const std::string &shader_name, const std::string &source, DtGlShaderType shaderType, unsigned int &shaderID) |
| Compiles a shader of type shaderType using source. More... | |
Protected Attributes | |
| unsigned int | myShaderID |
| bool | myIsValid |
Private Member Functions | |
| DtGlShader () | |
| private default constructor. not allowed. More... | |
| DtGlShader (const DtGlShader &) | |
| prevent copy-construction More... | |
| DtGlShader & | operator= (const DtGlShader &) |
| prevent assignment More... | |
A convenience class to represent an OpenGL Shader.
| makVrv::DtGlShader::DtGlShader | ( | const std::string & | name, |
| const std::string & | source, | ||
| DtGlShaderType | type | ||
| ) |
create a shader with a given name, from a string source of the given shader type
|
virtual |
destroy the shader
|
private |
private default constructor. not allowed.
|
private |
prevent copy-construction
|
private |
prevent assignment
|
virtual |
a valid shader is one that is compiled without error and is ready to use in an OpenGL program
the OpenGL ID of the internal OpenGL shader
|
static |
static API functions
Loads shader source code from a file.
|
static |
Saves shader source code to a file.
|
static |
Moves the #version directive to the top of the shader string to prevent shader compilation errors.
|
static |
Loop over the OpenGL shader ids in the shaderVector and deletes them from OpenGL.
|
static |
Compiles a shader of type shaderType using source.
shaderID is the new shader id Returns True is the compile succeeded
|
protected |