NGL
6.5
The NCCA Graphics Library
|
and encapsulation of an OpenGL Shader object with associations for source code, etc. Used in conjunction with the ShaderProgram class More...
#include <Shader.h>
Public Member Functions | |
Shader (std::string _name, ShaderType _type) noexcept | |
ctor More... | |
~Shader () | |
dtor, will clean up shader source and remove shader from GL More... | |
void | compile () noexcept |
compile the current shader will check to see if source is attached and issue warning if not More... | |
void | load (std::string _name) noexcept |
load in shader source and attach it to the shader object if source is already loaded it will re-load and re-attached More... | |
void | loadFromString (const std::string &_string) noexcept |
void | toggleDebug () noexcept |
toggle the debug state More... | |
GLuint | getShaderHandle () const noexcept |
get the shader handle for this shader More... | |
void | incrementRefCount () noexcept |
increment the shader ref count so we can see how many program objects are using this shader More... | |
void | decrementRefCount () noexcept |
decrement the reference counteer More... | |
int | getRefCount () const noexcept |
return the number of ProgramObjects referencing this shader More... | |
const std::string | getShaderSource () const noexcept |
the shader source More... | |
Private Attributes | |
std::string | m_name |
the text name of this Shader used in the search for shader More... | |
std::string | m_source |
the actual source code for this shader (used for debug and initial loading) More... | |
bool | m_compiled |
flag to indicate if the shader has been compiled this will get channged on re-load of source to false More... | |
ShaderType | m_shaderType |
what type of shader we are More... | |
GLuint | m_shaderHandle |
the GL handle for this shader object used in linking etc More... | |
bool | m_debugState |
flag to indicate the debug state More... | |
int | m_refCount |
number of ProgramObjects referencing this shader More... | |
and encapsulation of an OpenGL Shader object with associations for source code, etc. Used in conjunction with the ShaderProgram class
|
noexcept |
ctor
_name | the name of the program object | |
[in] | _type | the type of shader we are building |
Definition at line 52 of file Shader.cpp.
References ngl::COMPUTE, ngl::FRAGMENT, ngl::GEOMETRY, GL_COMPUTE_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_VERTEX_SHADER, glCreateShader, ngl::NONE, ngl::TESSCONTROL, ngl::TESSEVAL, and ngl::VERTEX.
ngl::Shader::~Shader | ( | ) |
dtor, will clean up shader source and remove shader from GL
Definition at line 74 of file Shader.cpp.
References glDeleteShader, m_name, and m_shaderHandle.
|
noexcept |
compile the current shader will check to see if source is attached and issue warning if not
Definition at line 80 of file Shader.cpp.
References GL_COMPILE_STATUS, GL_FALSE, glCompileShader, glGetShaderiv, m_compiled, m_debugState, m_name, m_shaderHandle, m_source, and ngl::printInfoLog().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
load in shader source and attach it to the shader object if source is already loaded it will re-load and re-attached
_name | the file name for the source we are loading |
Definition at line 105 of file Shader.cpp.
References glShaderSource, m_compiled, m_debugState, m_shaderHandle, m_source, and ngl::printInfoLog().
|
noexcept |
Definition at line 134 of file Shader.cpp.
References glShaderSource, m_compiled, m_debugState, m_shaderHandle, m_source, and ngl::printInfoLog().
|
inlinenoexcept |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |