]> git.localhorst.tv Git - blank.git/blob - src/shader.hpp
initial testing
[blank.git] / src / shader.hpp
1 #ifndef BLANK_SHADER_HPP_
2 #define BLANK_SHADER_HPP_
3
4 #include <iosfwd>
5 #include <GL/glew.h>
6
7
8 namespace blank {
9
10 class Shader {
11
12 public:
13         explicit Shader(GLenum type);
14         ~Shader();
15
16         Shader(Shader &&);
17         Shader &operator =(Shader &&);
18
19         Shader(const Shader &) = delete;
20         Shader &operator =(const Shader &) = delete;
21
22         void Source(const GLchar *src);
23         void Compile();
24         bool Compiled() const;
25         void Log(std::ostream &) const;
26
27         void AttachToProgram(GLuint id) const;
28
29 private:
30         GLuint handle;
31
32 };
33
34
35 class Program {
36
37 public:
38         Program();
39         ~Program();
40
41         Program(const Program &) = delete;
42         Program &operator =(const Program &) = delete;
43
44         void Attach(Shader &);
45         void Link();
46         bool Linked() const;
47         void Log(std::ostream &) const;
48
49         GLint UniformLocation(const GLchar *name) const;
50
51         void Use() const { glUseProgram(handle); }
52
53 private:
54         GLuint handle;
55
56 };
57
58 }
59
60 #endif