Shader.h 889 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef DEF_SHADER
  2. #define DEF_SHADER
  3. // Include Windows
  4. #ifdef WIN32
  5. #include <GL/glew.h>
  6. // Include Mac
  7. #elif __APPLE__
  8. #define GL3_PROTOTYPES 1
  9. #include <OpenGL/gl3.h>
  10. // Include UNIX/Linux
  11. #else
  12. #define GL3_PROTOTYPES 1
  13. #include <GLES3/gl3.h>
  14. #endif
  15. // Includes communs
  16. #include <iostream>
  17. #include <string>
  18. #include <fstream>
  19. // Classe Shader
  20. class Shader
  21. {
  22. public:
  23. Shader();
  24. Shader(Shader const &shaderACopier);
  25. Shader(std::string vertexSource, std::string fragmentSource);
  26. ~Shader();
  27. Shader& operator=(Shader const &shaderACopier);
  28. bool charger();
  29. bool compilerShader(GLuint &shader, GLenum type, std::string const &fichierSource);
  30. GLuint getProgramID() const;
  31. private:
  32. GLuint m_vertexID;
  33. GLuint m_fragmentID;
  34. GLuint m_programID;
  35. std::string m_vertexSource;
  36. std::string m_fragmentSource;
  37. };
  38. #endif