YAGE
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 
20 {
21 private:
22  // compiled shader program id
23  GLuint program_id_ = 0;
24  GLuint vertex_shader_id_ = 0;
25  GLuint fragment_shader_id_ = 0;
26  int attribute_index_ = 0;
27 
28  // compiles one shader
29  void compileShader(const GLuint &shader, const std::string &file_path);
30 public:
31  GlslProgram();
32  ~GlslProgram();
33 
34  // compiles vertex and fragment shader
35  void compileShaders(const std::string &vertex_shader_path, const std::string &fragment_shader_path);
36  void linkShaders();
37  void addAttribute(const std::string &attribute_name);
38  GLint getUniformLocation(const std::string &uniform_name);
39  void use();
40  void unuse();
41 };
42 
43 } // yage
44 
45 #endif
Definition: glslprogram.hpp:19
Definition: camera2d.hpp:17