]> git.localhorst.tv Git - blank.git/blob - src/graphics/Program.hpp
ff01f9dafd1e78b17b2b3980264cf603b6f25a04
[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 #include <glm/glm.hpp>
8
9
10 namespace blank {
11
12 class Shader;
13
14 class Program {
15
16 public:
17         Program();
18         ~Program();
19
20         Program(const Program &) = delete;
21         Program &operator =(const Program &) = delete;
22
23         const Shader &LoadShader(GLenum type, const GLchar *src);
24         void Attach(Shader &) noexcept;
25         void Link() noexcept;
26         bool Linked() const noexcept;
27         void Log(std::ostream &) const;
28
29         GLint AttributeLocation(const GLchar *name) const noexcept;
30         GLint UniformLocation(const GLchar *name) const noexcept;
31
32         void Uniform(GLint, GLint) noexcept;
33         void Uniform(GLint, float) noexcept;
34         void Uniform(GLint, const glm::vec3 &) noexcept;
35         void Uniform(GLint, const glm::vec4 &) noexcept;
36         void Uniform(GLint, const glm::mat4 &) noexcept;
37
38         void Use() const noexcept { glUseProgram(handle); }
39
40 private:
41         GLuint handle;
42         std::list<Shader> shaders;
43
44 };
45
46 }
47
48 #endif