![]() |
VR-Forces 5.0.2 Developer's Guide
|
A convenience class to represent an OpenGL Shader.
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) | |
| virtual | ~DtGlShader () |
| virtual bool | isValid () const |
| virtual unsigned int | id () const |
Static Public Member Functions | |
| static std::string | loadShaderSource (const std::string &strFileName, bool logWarning=true) |
| static void | saveShaderSource (const std::string &strFileName, const std::string &strSource) |
| static std::string | fixVersionDirective (const std::string &shaderString) |
| static void | deleteShaders (const std::vector< unsigned int > &shaderVector) |
| static bool | compileShader (const std::string &shader_name, const std::string &source, DtGlShaderType shaderType, unsigned int &shaderID) |
| static void | printGLSLInfoLog (unsigned int shader) |
Protected Attributes | |
| unsigned int | myShaderID |
| bool | myIsValid |
Private Member Functions | |
| DtGlShader () | |
| DtGlShader (const DtGlShader &) | |
| DtGlShader & | operator= (const DtGlShader &) |
| 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.
debug function for printing the info log for a shader compilation
|
protected |