ComputerGraphik TU WIEN
shader.hpp
Go to the documentation of this file.
1 #ifndef SHADER_HPP
2 #define SHADER_HPP
3 
4 #include <string>
5 #include <vector>
6 #include <GL/glew.h>
7 
9 class Shader {
10 public:
11  Shader(const std::vector<std::pair<GLenum, std::string> >& shaderPaths);
12  ~Shader();
13 
14  void use() const { glUseProgram(program_handle); }
15  GLuint programHandle() const { return program_handle; }
16 
17  static void loadTextFile(const std::string& filename, std::vector<char>& data);
18 
19 private:
21 
22  class ShaderObj;
23  friend class ShaderObj;
24  static GLuint compileShader(const std::vector<char>& shaderSrc, GLenum shaderType);
25 };
26 
27 #endif //SHADER_HPP
GLuint programHandle() const
Definition: shader.hpp:15
~Shader()
Definition: shader.cpp:68
static GLuint compileShader(const std::vector< char > &shaderSrc, GLenum shaderType)
Definition: shader.cpp:73
Helper class to manage one Shader object file in RAII style.
Definition: shader.cpp:8
Shader(const std::vector< std::pair< GLenum, std::string > > &shaderPaths)
Definition: shader.cpp:25
Encapsulates a shader program.
Definition: shader.hpp:9
static void loadTextFile(const std::string &filename, std::vector< char > &data)
Definition: shader.cpp:106
GLuint program_handle
Definition: shader.hpp:20
void use() const
Definition: shader.hpp:14