|
template<typename... Args> |
static void | create (std::string shader_name, GLenum type, std::string path, Args... args) |
| Create a new shader.
|
|
template<typename... Args> |
static void | 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 void | compile_shaders (std::vector< unsigned int > &compiled) |
|
template<typename... Args> |
static void | 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 void | use (types::shader_name_t shader_name) |
| Use the shader.
|
|
static void | set_bool (types::shader_name_t shader_name, const std::string &name, bool value) |
| Set a boolean in the shader.
|
|
static void | set_int (types::shader_name_t shader_name, const std::string &name, int value) |
| Set an integer in the shader.
|
|
static void | set_float (types::shader_name_t shader_name, const std::string &name, float value) |
| Set a float in the shader.
|
|
static void | set_mat4 (types::shader_name_t shader_name, const GLchar *name, glm::mat4 value) |
| Set a 4x4 matrix in the shader.
|
|
static void | 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 void | 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. The shader can be used with the Use method, and the uniforms can be set using the SetBool, SetInt, SetFloat, SetMat4, SetVec3 methods.
Definition at line 65 of file shader.hpp.
template<typename... Args>
static void 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 |
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 128 of file shader.hpp.
template<typename... Args>
static void 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 |
You can provide any number of types and paths, those will be all compiled and linked in the same program.
Definition at line 93 of file shader.hpp.