#ifndef SHADER_H #define SHADER_H #include #include "utils/Array.h" class Shader final { GLuint vertexShader; GLuint fragmentShader; GLuint program; public: Shader(const char* vertexPath, const char* fragmentPath); ~Shader(); Shader(const Shader& other) = delete; Shader(Shader&& other) = delete; Shader& operator=(const Shader& other) = delete; Shader& operator=(Shader&& other) = delete; bool hasError() const; void use() const; void setMatrix(const GLchar* name, const GLfloat* data); void setInt(const GLchar* name, GLint data); void setFloat(const GLchar* name, GLfloat data); private: typedef Array Code; typedef Array ErrorLog; bool readFileAndCompile(const char* path, GLuint& shader, GLenum shaderType); bool readFile(Code& code, const char* path) const; bool compile(GLuint& shader, const Code& code, GLenum shaderType); }; #endif