InfoVis 2013  1.0
Information Visualisation project - "Mapping Text with Phrase Nets"
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Shader.h
Go to the documentation of this file.
1 #ifndef SHADER_H
2 #define SHADER_H
3 
4 #include "windows.h"
5 #include "GL/glew.h"
6 #include "GL/glfw.h"
7 
8 #include <string>
9 
10 using namespace std;
11 
12 /* The Shader class is used for OpenGL shader wrapping */
13 class Shader
14 {
15 public:
16 
17  Shader(const std::string &path);
18  ~Shader();
19 
20  void bind() const;
21 
22  void unbind() const;
23 
24  GLint getAttribLocation(const std::string &name) const;
25 
26  GLint getUniformLocation(const std::string &name) const;
27 
28  bool isCreatedSuccessfully() const;
29 
30 private:
31  std::string m_shaderName;
32  bool createdSucessfully;
33 
34  GLuint m_vertexShader;
35  GLuint m_fragmentShader;
36  GLuint m_geometryShader;
37  GLuint m_program;
38 
39 
40  GLuint compile(GLenum type, const string &source, const string &path);
41  void link();
42 
43  void outputShaderLog(GLuint shader);
44  void outputProgramLog(GLuint program);
45 };
46 
47 #endif