Cube.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef DEF_CUBE
  2. #define DEF_CUBE
  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 GLM
  16. #include <glm/glm.hpp>
  17. #define GLM_ENABLE_EXPERIMENTAL
  18. #include <glm/gtx/transform.hpp>
  19. #include <glm/gtc/type_ptr.hpp>
  20. // Includes
  21. #include "../Shader.h"
  22. // Macro utile au VBO
  23. #ifndef BUFFER_OFFSET
  24. #define BUFFER_OFFSET(offset) ((char*)NULL + (offset))
  25. #endif
  26. // Classe Cube
  27. class Cube
  28. {
  29. public:
  30. Cube(float taille, std::string const vertexShader, std::string const fragmentShader);
  31. ~Cube();
  32. void charger();
  33. void afficher(glm::mat4 &projection, glm::mat4 &modelview);
  34. void updateVBO(void *donnees, int tailleBytes, int decalage);
  35. protected:
  36. Shader m_shader;
  37. float m_vertices[108];
  38. float m_couleurs[108];
  39. GLuint m_vboID;
  40. int m_tailleVerticesBytes;
  41. int m_tailleCouleursBytes;
  42. GLuint m_vaoID;
  43. };
  44. #endif