123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef SHADER_H
- #define SHADER_H
- #include <GL/glew.h>
- #include <GLFW/glfw3.h>
- #include <iostream>
- #include <vector>
- class Shader final
- {
- public:
- Shader(const GLchar* vPath, const GLchar* fPath);
- ~Shader();
- bool isValid() const;
- void use() const;
- void setMatrix(const GLchar* name, const float* data) const;
- void setInt(const GLchar* name, GLint data) const;
-
- private:
- Shader(const Shader& other) = delete;
- Shader(Shader&& other) = delete;
- Shader& operator=(const Shader& other) = delete;
- Shader& operator=(Shader&& other) = delete;
-
- bool readFile(std::vector<GLchar>& buffer, const GLchar* path) const;
- bool compileShader(GLuint& shader, const GLchar* code, GLenum shaderType) const;
-
- bool valid;
- GLuint vShader;
- GLuint fShader;
- GLuint program;
- };
- #endif
|