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