]> git.localhorst.tv Git - blank.git/blob - src/graphics/Program.hpp
some code reorganization
[blank.git] / src / graphics / Program.hpp
1 #ifndef BLANK_GRAPHICS_PROGRAM_HPP_
2 #define BLANK_GRAPHICS_PROGRAM_HPP_
3
4 #include <iosfwd>
5 #include <list>
6 #include <GL/glew.h>
7
8
9 namespace blank {
10
11 class Shader;
12
13 class Program {
14
15 public:
16         Program();
17         ~Program();
18
19         Program(const Program &) = delete;
20         Program &operator =(const Program &) = delete;
21
22         const Shader &LoadShader(GLenum type, const GLchar *src);
23         void Attach(Shader &) noexcept;
24         void Link() noexcept;
25         bool Linked() const noexcept;
26         void Log(std::ostream &) const;
27
28         GLint AttributeLocation(const GLchar *name) const noexcept;
29         GLint UniformLocation(const GLchar *name) const noexcept;
30
31         void Use() const noexcept { glUseProgram(handle); }
32
33 private:
34         GLuint handle;
35         std::list<Shader> shaders;
36
37 };
38
39 }
40
41 #endif