Cutout Vis2012
TUWienVisualisierung2(SS2012)-AdaptiveCutaways
 All Classes Namespaces Functions Pages
Shader.h
1 #ifndef _SHADER_H_
2 #define _SHADER_H_
3 
4 #include "include_opengl.h"
5 
6 #include <string>
7 
11 class Shader
12 {
13 public:
14  Shader();
18  Shader(const std::string& name);
19  ~Shader();
20 
24  bool attachShaderSource(int type, const std::string& source);
29  bool attachShaderFile(int type, const std::string& path);
30 
34  bool compileShaders();
38  bool link(const std::string& out);
43  bool link(const std::string* out, int numAttachments);
44 
48  void bind();
52  void unbind();
53 
57  GLint getUniformLocation(const std::string& name) const;
61  GLint getAttribLocation(const std::string& name) const;
62 
63  const std::string& getName() const;
64 
65 private:
66  std::string _name;
67  GLuint _programHandle;
68  GLuint _vertexHandle, /*_tessControlHandle, _tessEvalHandle,*/ _geomHandle, _fragHandle;
69  bool _compiled, _linked;
70 
71  std::string getShaderTypeString(GLint type);
72 };
73 
74 #endif