123456789101112131415161718192021222324252627282930 |
- #ifndef SHADER_H
- #define SHADER_H
- #include <GL/glew.h>
- class Shader final {
- public:
- Shader(const GLchar* vPath, const GLchar* fPath);
- ~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) const;
- void setInt(const GLchar* name, GLint data) const;
- private:
- bool readFileAndCompile(const GLchar* path, GLuint& shader, GLenum shaderType);
- bool readFile(GLchar* buffer, size_t bufferSize, const GLchar* path) const;
- bool compile(GLuint& shader, const GLchar* code, GLenum shaderType);
- GLuint vShader;
- GLuint fShader;
- GLuint program;
- };
- #endif
|