UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
shader.h
Go to the documentation of this file.
1 #ifndef UGDK_GRAPHIC_SHADER_H_
2 #define UGDK_GRAPHIC_SHADER_H_
3 
4 #include <string>
5 #include <ugdk/graphic/opengl.h>
6 
7 namespace ugdk {
8 namespace graphic {
9 
10 class Shader {
11  public:
12  Shader(GLuint shaderType);
13  ~Shader();
14 
15  GLuint id() const { return id_; }
16 
17  void AddLineInMain(const std::string& line) { main_ += line; }
18  void AddCodeBlock(const std::string& block) { blocks_ += block; }
19 
20  void GenerateSource();
21 
22  bool Compile() const;
23 
25 
28  void set_source(const std::string& source) { source_ = source; }
29 
30  protected:
31  GLuint id_;
32  GLuint type_;
33  std::string source_;
34 
35  std::string blocks_;
36  std::string main_;
37 };
38 
39 } // namespace graphic
40 } // namespace ugdk
41 
42 #endif // UGDK_GRAPHIC_SHADER_H_
bool Compile() const
std::string blocks_
Definition: shader.h:35
void AddCodeBlock(const std::string &block)
Definition: shader.h:18
Definition: shader.h:10
Definition: animation.h:11
void set_source(const std::string &source)
Sets the source code for this shader.
Definition: shader.h:28
void AddLineInMain(const std::string &line)
Definition: shader.h:17
Shader(GLuint shaderType)
std::string source_
Definition: shader.h:33
GLuint type_
Definition: shader.h:32
GLuint id() const
Definition: shader.h:15
std::string main_
Definition: shader.h:36
GLuint id_
Definition: shader.h:31