/* * ===================================================================================== * * Filename: Shader.hpp * * Description: * * Created: 15/12/2014 16:30:20 * * Author: Quentin Bazin, * * ===================================================================================== */ #ifndef SHADER_HPP_ #define SHADER_HPP_ #include #include #include #include "OpenGL.hpp" class Shader { public: Shader() = default; Shader(const std::string &vertexFilename, const std::string &fragementFilename); ~Shader(); void loadFromFile(const std::string &vertexFilename, const std::string &fragementFilename); void createProgram(); void linkProgram(); void addShader(GLenum type, const std::string &filename); GLint attrib(const std::string &name) const; GLint uniform(const std::string &name) const; void enableVertexAttribArray(const std::string &name) const; void disableVertexAttribArray(const std::string &name) const; void setUniform(const std::string &name, int n) const; void setUniform(const std::string &name, const glm::mat4 &matrix) const; static void bind(const Shader *shader); GLint program() const { return m_program; } private: std::vector m_vertexShaders; std::vector m_fragmentShaders; GLuint m_program; }; #endif // SHADER_HPP_