#include <Shader.hpp>
A Shader is a little program that rest on the GPU. They are run on a specific section of the graphic pipeline. More...
A Shader is a little program that rest on the GPU. They are run on a specific section of the graphic pipeline.
This class is movable and copyable (via internal ref-count).
This class is independant from SMK.
Definition at line 66 of file Shader.hpp.
Public Member Functions | |
bool | IsReady () const |
Check the status of a Shader. Linking shader is an asynchronous process. Using the shader can causes the CPU to wait until its completion. If you need to do some work before the completion, you can use this function and use the Shader only after it becomes ready. More... | |
bool | CompileStatus () const |
Wait until the Shader to be ready. More... | |
GLuint | id () const |
The GPU shader id. More... | |
Shader (Shader &&) noexcept | |
Shader (const Shader &) noexcept | |
Shader & | operator= (Shader &&) noexcept |
Shader & | operator= (const Shader &) noexcept |
Static Public Member Functions | |
static Shader | FromFile (const std::string &filename, GLenum type) |
Load a shader from a file. More... | |
static Shader | FromString (const std::string &content, GLenum type) |
Load a shader from a std::string. More... | |
smk::Shader::~Shader | ( | ) |
Definition at line 132 of file Shader.cpp.
|
noexcept |
Definition at line 140 of file Shader.cpp.
|
noexcept |
Definition at line 136 of file Shader.cpp.
bool smk::Shader::CompileStatus | ( | ) | const |
Wait until the Shader to be ready.
Definition at line 113 of file Shader.cpp.
|
static |
Load a shader from a file.
filename | The text filename where the shader is written. |
type | Either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. It can also be any other shader type defined by OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateShader.xhtml |
Definition at line 42 of file Shader.cpp.
|
static |
Load a shader from a std::string.
content | The string representing the shader. |
type | Either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. It can also be any other shader type defined by OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glCreateShader.xhtml |
Definition at line 60 of file Shader.cpp.
GLuint smk::Shader::id | ( | ) | const |
The GPU shader id.
Definition at line 74 of file Shader.cpp.
bool smk::Shader::IsReady | ( | ) | const |
Check the status of a Shader. Linking shader is an asynchronous process. Using the shader can causes the CPU to wait until its completion. If you need to do some work before the completion, you can use this function and use the Shader only after it becomes ready.
Definition at line 100 of file Shader.cpp.
Definition at line 144 of file Shader.cpp.
Definition at line 164 of file Shader.cpp.