GLS
1.0.0
GL Stuff - A library aimed at reducing the boilerplate OpenGL code you always have to write.
|
Class encapsulating an OpenGL shader object. More...
#include <shader.hpp>
Public Member Functions | |
GLuint | name () const |
Retrieve the OpenGL name of this shader. More... | |
bool | compile (const std::string &source) |
Compile this shader from the given source. More... | |
std::string | get_info_log () const |
Get the link information log. More... | |
Class encapsulating an OpenGL shader object.
A gls::shader is an object that encapsulates an OpenGL shader object.
Type | The type of this shader (e.g. GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc.) |
It is used along with other gls::shader objects as part of a gls::program object. Like all objects in GLS, the underlying name is generated at object construction and deleted at destruction. This can be retrieved with name().
In order to link a gls::shader object with other gls::shader objects as part of a gls::program, you need to have successfully compiled them all. If compiling fails, you can check the information log for the cause.
Example usage:
GLuint name | ( | ) | const |
Retrieve the OpenGL name of this shader.
bool compile | ( | const std::string & | source | ) |
Compile this shader from the given source.
This will attempt to compile the shader using the given source. Checking the produced information log with get_info_log() can help to solve errors that occur or warnings the driver might have produced.
After successfully compiling a set of shaders, link them into a gls::program object in order to use them as part of the program.
source | String containing the source to compile |
std::string get_info_log | ( | ) | const |
Get the link information log.
After compiling, whether successful or not, an information log might be available. Check this information log for warnings after successful compiling, or errors after failed compiling. The information log may be empty if compiling was successful.