diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-04-04 12:19:41 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-04-04 12:19:41 +0100 |
commit | 55a1e0ad7c9d2661c266b2e767bfcb2f944e859f (patch) | |
tree | fe3ac90ab853e2f87bd33294976a3fc56e144988 /include/YAGE/glslprogram.hpp | |
parent | aa67c8bb56cb750ac83ecbd361439f5ecb5e12d9 (diff) | |
download | YAGE-55a1e0ad7c9d2661c266b2e767bfcb2f944e859f.tar.gz YAGE-55a1e0ad7c9d2661c266b2e767bfcb2f944e859f.zip |
Adding spritebatch class
Diffstat (limited to 'include/YAGE/glslprogram.hpp')
-rw-r--r-- | include/YAGE/glslprogram.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/YAGE/glslprogram.hpp b/include/YAGE/glslprogram.hpp new file mode 100644 index 00000000..3e03723a --- /dev/null +++ b/include/YAGE/glslprogram.hpp @@ -0,0 +1,37 @@ +#ifndef GLSL_PROGRAM_HPP +#define GLSL_PROGRAM_HPP + +#include <GL/glew.h> + +#include <string> + +namespace yage +{ + +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(); +}; + +} // yage + +#endif |