diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-04-02 09:19:32 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-04-02 09:19:32 +0100 |
commit | aa67c8bb56cb750ac83ecbd361439f5ecb5e12d9 (patch) | |
tree | f1517a86654cf5457fa0b3aa6cfaea4bfa4eef36 /include/YAGE/glsl_program.hpp | |
parent | 21a147c3c1c2fad2819fe76becab320c51eb131f (diff) | |
download | YAGE-aa67c8bb56cb750ac83ecbd361439f5ecb5e12d9.tar.gz YAGE-aa67c8bb56cb750ac83ecbd361439f5ecb5e12d9.zip |
Renamed includes
Diffstat (limited to 'include/YAGE/glsl_program.hpp')
-rw-r--r-- | include/YAGE/glsl_program.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/YAGE/glsl_program.hpp b/include/YAGE/glsl_program.hpp new file mode 100644 index 00000000..cef38a8e --- /dev/null +++ b/include/YAGE/glsl_program.hpp @@ -0,0 +1,33 @@ +#ifndef GLSL_PROGRAM_HPP +#define GLSL_PROGRAM_HPP + +#include <GL/glew.h> + +#include <string> + +class GlslProgram +{ +private: + // compiled shader program id + GLuint program_id_ = 0; + GLuint vertex_shader_id_ = 0; + GLuint fragment_shader_id_ = 0; + int attribute_index_ = 0; + + // compiles one shader + void compileShader(const GLuint &shader, const std::string &file_path); +public: + GlslProgram(); + ~GlslProgram(); + + // compiles vertex and fragment shader + void compileShaders(const std::string &vertex_shader_path, const std::string &fragment_shader_path); + void linkShaders(); + void addAttribute(const std::string &attribute_name); + GLint getUniformLocation(const std::string &uniform_name); + void use(); + void unuse(); +}; + + +#endif |