MRPT
1.9.9
|
A resource handling helper for OpenGL "Shader" compiled code fragment.
The OpenGL shader resource will be freed upon destruction or when clear() is called. Normally, users want shader(s) to be linked into a mrpt::opengl::Program.
#include <mrpt/opengl/Shader.h>
Public Member Functions | |
Shader ()=default | |
~Shader () | |
Shader & | operator= (const Shader &)=delete |
Shader (const Shader &)=delete | |
Shader & | operator= (Shader &&) |
Shader (Shader &&) | |
bool | empty () const |
void | clear () |
Frees the shader program in OpenGL. More... | |
bool | compile (unsigned int type, const std::string &shaderCode, mrpt::optional_ref< std::string > outErrorMessages=std::nullopt) |
Build a shader from source code. More... | |
unsigned int | handle () const |
Private Attributes | |
unsigned int | m_shader = 0 |
|
default |
Shader::~Shader | ( | ) |
Definition at line 21 of file Shader.cpp.
References mrpt::containers::clear().
|
delete |
Shader::Shader | ( | Shader && | o | ) |
Definition at line 28 of file Shader.cpp.
void Shader::clear | ( | ) |
Frees the shader program in OpenGL.
Definition at line 34 of file Shader.cpp.
bool Shader::compile | ( | unsigned int | type, |
const std::string & | shaderCode, | ||
mrpt::optional_ref< std::string > | outErrorMessages = std::nullopt |
||
) |
Build a shader from source code.
[in] | type | Any valid argument to glCreateShader() |
[in] | shaderCode | The shading source code. Tip: users can read it from a file with mrpt::io::file_get_contents(). |
[out] | outErrorMessages | If provided, build errors will be saved here. If not, they will dumped to std::cerr |
Definition at line 43 of file Shader.cpp.
References mrpt::containers::clear(), and THROW_EXCEPTION.
|
inline |
|
inline |
Definition at line 22 of file Shader.cpp.
References m_shader.
|
private |
Definition at line 66 of file Shader.h.
Referenced by empty(), handle(), and operator=().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020 |