zMol
A viewer for molecular data using OpenGL and ambient occlusion
|
#include <glsl.hpp>
Inherits zmol::noncopyable_::noncopyable.
Public Member Functions | |
shader (GLenum const p_type) | |
~shader () | |
GLuint | get_name () const |
bool | compile_and_store (std::string const &p_code) |
std::string | get_info_log () const |
Shader object wrapper class.
The class creates a shader object in the constructor, and destroys it in the destructor. This makes proper use of the C++ RAII idiom, and ensures exception safety (-> no resource leak).
Ownership of shader instances can be transferred to program instances. This is useful to make sure that shaders are cleaned up when no programs that need them are around. See program and build_program for details.
|
explicit |
Constructor. Creates a shader object using glCreateShader().
p_type | Type of the shader (GL_VERTEX_SHADER/GL_FRAGMENT_SHADER/...). |
zmol::shader::~shader | ( | ) |
Destructor. Destroys a shader object using glDeleteShader().
bool zmol::shader::compile_and_store | ( | std::string const & | p_code | ) |
Compiles shader code and stores it in the shader object. If any compilation errors happen, get_info_log() will return details.
p_code | GLSL source code to compile and store. |
std::string zmol::shader::get_info_log | ( | ) | const |
Returns information about compilation errors.
|
inline |
Returns the OpenGL name of the shader object.