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