YAGE  0.02
Yet Another Game Engine
glslprogram.hpp
1 /* ----------------------------------------------------------------------------
2  * glslprogram.hpp
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
5  * See file LICENSE for more details
6  * ----------------------------------------------------------------------------
7  */
8 
9 #ifndef GLSL_PROGRAM_HPP
10 #define GLSL_PROGRAM_HPP
11 
12 #include <GL/glew.h>
13 
14 #include <string>
15 
16 namespace yage {
17 
18 class GlslProgram {
19 private:
21  GLuint program_id_ = 0;
22  GLuint vertex_shader_id_ = 0;
23  GLuint fragment_shader_id_ = 0;
24  int attribute_index_ = 0;
25 
27  void compileShader(const GLuint& shader, const std::string& file_path);
28 
29 public:
30  GlslProgram() = default;
31  GlslProgram(const GlslProgram&) = delete;
32  GlslProgram(GlslProgram&&) = delete;
33  ~GlslProgram();
34 
35  GlslProgram& operator=(const GlslProgram&) = delete;
36  GlslProgram& operator=(GlslProgram&&) = delete;
37 
39  void compileShaders(const std::string& vertex_shader_path,
40  const std::string& fragment_shader_path);
41  void linkShaders();
42  void addAttribute(const std::string& attribute_name);
43  GLint getUniformLocation(const std::string& uniform_name);
44  void use();
45  void unuse();
46 };
47 
48 } // yage
49 
50 #endif
Definition: camera2d.hpp:17