Cube.h 1006 B

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