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