SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Encapsulation of an OpenGL shader object. More...
#include <SLGLShader.h>
Public Member Functions | |
SLGLShader () | |
Default constructor. More... | |
SLGLShader (const SLstring &filename, SLShaderType type) | |
Ctor with shader filename & shader type. More... | |
~SLGLShader () override | |
void | load (const SLstring &filename) |
SLGLShader::load loads a shader file into string _shaderSource. More... | |
void | loadFromMemory (const SLstring &program) |
SLGLShader::load loads a shader file from memory into memory. More... | |
SLstring | typeName () |
Returns the shader type as string. More... | |
SLShaderType | type () |
SLuint | shaderID () const |
SLstring | code () |
void | code (SLstring strCode) |
void | file (SLstring strFile) |
Public Member Functions inherited from SLObject | |
SLObject (const SLstring &Name="", const SLstring &url="") | |
virtual | ~SLObject () |
void | name (const SLstring &Name) |
void | url (const SLstring &url) |
const SLstring & | name () const |
const SLstring & | url () const |
Static Public Member Functions | |
static SLstring | removeComments (SLstring src) |
SLGLShader::removeComments for C/C++ comments removal from shader code. More... | |
Protected Attributes | |
SLShaderType | _type |
Shader type enumeration. More... | |
SLuint | _shaderID |
Program Object. More... | |
SLstring | _code |
ASCII Source-Code. More... | |
SLstring | _file |
Path & filename of shader. More... | |
Protected Attributes inherited from SLObject | |
SLstring | _name |
name of an object More... | |
SLstring | _url |
uniform resource locator More... | |
Private Member Functions | |
SLbool | createAndCompile (SLVLight *lights) |
SLGLShader::createAndCompile creates & compiles the OpenGL shader object. More... | |
SLstring | preprocessIncludePragmas (SLstring inCode) |
Replaces our custom pragma include directives in GLSL code. More... | |
SLstring | preprocessDefinePragmas (SLstring inCode, SLVLight *lights) |
Replaces our custom pragma define directives in GLSL code. More... | |
Friends | |
class | SLGLProgram |
Encapsulation of an OpenGL shader object.
The SLGLShader class represents a shader object of the OpenGL Shading Language (GLSL). It can load & compile an GLSL shader file and is later on attached to an OpenGL program (SLGLProgram). Instances of SLShader are owned and deleted by their program (SLGLProgram).
Definition at line 24 of file SLGLShader.h.
SLGLShader::SLGLShader | ( | ) |
SLGLShader::SLGLShader | ( | const SLstring & | filename, |
SLShaderType | shaderType | ||
) |
Ctor with shader filename & shader type.
If the shader filename does not belong to an existing file the shader code will be generated at a later stage by SLGLProgramGenerated.
filename | Path and filename of the shader to be loaded or generated. |
shaderType | Shader type: ST_vertex, ST_fragment and ST_geometry. |
Definition at line 40 of file SLGLShader.cpp.
|
override |
Definition at line 74 of file SLGLShader.cpp.
|
inline |
Definition at line 42 of file SLGLShader.h.
Definition at line 45 of file SLGLShader.h.
SLGLShader::createAndCompile creates & compiles the OpenGL shader object.
Definition at line 86 of file SLGLShader.cpp.
Definition at line 46 of file SLGLShader.h.
SLGLShader::load loads a shader file into string _shaderSource.
Definition at line 54 of file SLGLShader.cpp.
SLGLShader::load loads a shader file from memory into memory.
Definition at line 69 of file SLGLShader.cpp.
Replaces our custom pragma define
directives in GLSL code.
Definition at line 304 of file SLGLShader.cpp.
Replaces our custom pragma include
directives in GLSL code.
Definition at line 254 of file SLGLShader.cpp.
SLGLShader::removeComments for C/C++ comments removal from shader code.
Definition at line 201 of file SLGLShader.cpp.
|
inline |
Definition at line 41 of file SLGLShader.h.
|
inline |
Definition at line 40 of file SLGLShader.h.
SLstring SLGLShader::typeName | ( | ) |
|
friend |
Definition at line 26 of file SLGLShader.h.
|
protected |
ASCII Source-Code.
Definition at line 56 of file SLGLShader.h.
|
protected |
Path & filename of shader.
Definition at line 57 of file SLGLShader.h.
|
protected |
Program Object.
Definition at line 55 of file SLGLShader.h.
|
protected |
Shader type enumeration.
Definition at line 54 of file SLGLShader.h.