|
| template<typename... Args> |
| static bool | create (std::string shader_name, GLenum type, std::string path, Args... args) |
| | Create a new shader.
|
| |
| template<typename... Args> |
| static bool | create (const GLchar **feedback_varyings, int num_varyings, std::string shader_name, GLenum type, std::string path, Args... args) |
| | Create a new shader with feedback varyings.
|
| |
| static bool | compile_shaders (std::vector< unsigned int > &compiled) |
| |
| template<typename... Args> |
| static bool | compile_shaders (std::vector< unsigned int > &compiled, GLenum type, std::string path, Args... args) |
| |
| static unsigned int | get_id (types::shader_name_t shader_name) |
| | Get the ID of a shader.
|
| |
| static bool | use (types::shader_name_t shader_name) |
| | Use the shader.
|
| |
| static bool | set_bool (types::shader_name_t shader_name, const GLchar *name, bool value) |
| | Set a boolean in the shader.
|
| |
| static bool | set_int (types::shader_name_t shader_name, const GLchar *name, int value) |
| | Set an integer in the shader.
|
| |
| static bool | set_float (types::shader_name_t shader_name, const GLchar *name, float value) |
| | Set a float in the shader.
|
| |
| static bool | set_mat4 (types::shader_name_t shader_name, const GLchar *name, glm::mat4 value) |
| | Set a 4x4 matrix in the shader.
|
| |
| static bool | set_vec3 (types::shader_name_t shader_name, const GLchar *name, float x, float y, float z) |
| | Set a 3D vector in the shader.
|
| |
| static bool | set_vec3 (types::shader_name_t shader_name, const GLchar *name, glm::vec3 value) |
| | Set a 3D vector in the shader.
|
| |
Shader class.
This class is used to create and manage shaders. The shaders are created using the new method, which takes the name of the shader, the type of the shader, and the path to the file that contains the shader code. Multile shaders can be compiled and linked together by providing any number of types and paths paired. The shader can be used with the Use method, and the uniforms can be set using the set_bool, set_int, set_float, set_mat4, set_vec3 methods.
Definition at line 42 of file shader.hpp.
template<typename... Args>
| static bool brenta::shader::create |
( |
const GLchar ** | feedback_varyings, |
|
|
int | num_varyings, |
|
|
std::string | shader_name, |
|
|
GLenum | type, |
|
|
std::string | path, |
|
|
Args... | args ) |
|
inlinestatic |
Create a new shader with feedback varyings.
- Parameters
-
| feedback_varyings | Array of feedback varyings |
| num_varyings | Number of feedback varyings |
| shader_name | Name of the shader |
| type | Type of the shader |
| path | Path to the file that contains the shader code |
- Returns
- true on success, or false on error
Same as the New method, but adds feedback varyings to the shader, so that the output of the shader can be saved in a buffer object.
Example feedback_varyings: const GLchar* feedback_varyings[] = {"outValue"};
Definition at line 115 of file shader.hpp.
template<typename... Args>
| static bool brenta::shader::create |
( |
std::string | shader_name, |
|
|
GLenum | type, |
|
|
std::string | path, |
|
|
Args... | args ) |
|
inlinestatic |
Create a new shader.
This method is used to create a new shader with the given name, type, and path. The path is the path to the file that contains the shader code. The type is the type of the shader (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER).
- Parameters
-
| shader_name | Name of the shader |
| type | Type of the shader |
| path | Path to the file that contains the shader code |
- Returns
- true on success, or false on error
You can provide any number of types and paths, those will be all compiled and linked in the same program.
Definition at line 71 of file shader.hpp.