Shader.h 837 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef SHADER_H
  2. #define SHADER_H
  3. #include <GL/glew.h>
  4. #include <GLFW/glfw3.h>
  5. #include <iostream>
  6. #include <vector>
  7. class Shader final
  8. {
  9. public:
  10. Shader(const GLchar* vPath, const GLchar* fPath);
  11. ~Shader();
  12. bool isValid() const;
  13. void use() const;
  14. void setMatrix(const GLchar* name, const float* data) const;
  15. void setInt(const GLchar* name, GLint data) const;
  16. private:
  17. Shader(const Shader& other) = delete;
  18. Shader(Shader&& other) = delete;
  19. Shader& operator=(const Shader& other) = delete;
  20. Shader& operator=(Shader&& other) = delete;
  21. bool readFile(std::vector<GLchar>& buffer, const GLchar* path) const;
  22. bool compileShader(GLuint& shader, const GLchar* code, GLenum shaderType) const;
  23. bool valid;
  24. GLuint vShader;
  25. GLuint fShader;
  26. GLuint program;
  27. };
  28. #endif