Shader.h 782 B

1234567891011121314151617181920212223242526272829303132333435
  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. private:
  16. Shader(const Shader& other) = delete;
  17. Shader(Shader&& other) = delete;
  18. Shader& operator=(const Shader& other) = delete;
  19. Shader& operator=(Shader&& other) = delete;
  20. bool readFile(std::vector<GLchar>& buffer, const GLchar* path) const;
  21. bool compileShader(GLuint& shader, const GLchar* code, GLenum shaderType) const;
  22. bool valid;
  23. GLuint vShader;
  24. GLuint fShader;
  25. GLuint program;
  26. };
  27. #endif