]> git.localhorst.tv Git - gong.git/blob - src/graphics/Program.hpp
code, assets, and other stuff stolen from blank
[gong.git] / src / graphics / Program.hpp
1 #ifndef GONG_GRAPHICS_PROGRAM_HPP_
2 #define GONG_GRAPHICS_PROGRAM_HPP_
3
4 #include "glm.hpp"
5
6 #include <iosfwd>
7 #include <list>
8 #include <GL/glew.h>
9
10
11 namespace gong {
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