Texture.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef DEF_TEXTURE
  2. #define DEF_TEXTURE
  3. // Include Windows
  4. #ifdef WIN32
  5. #include <GL/glew.h>
  6. #include <SDL2/SDL_image.h>
  7. // Include Mac
  8. #elif __APPLE__
  9. #define GL3_PROTOTYPES 1
  10. #include <OpenGL/gl3.h>
  11. #include <SDL2_image/SDL_image.h>
  12. // Include UNIX/Linux
  13. #else
  14. #define GL3_PROTOTYPES 1
  15. #include <GLES3/gl3.h>
  16. #endif
  17. // Autres includes
  18. #include <SDL2/SDL.h>
  19. #include <iostream>
  20. #include <string>
  21. // Classe Textures
  22. class Texture
  23. {
  24. public:
  25. Texture();
  26. Texture(std::string fichierImage);
  27. Texture(int largeur, int hauteur, GLenum format = GL_RGBA, GLenum formatInterne = GL_RGBA, bool textureVide = true);
  28. Texture(Texture const &autre);
  29. ~Texture();
  30. Texture& operator=(Texture const &autre);
  31. bool createTexture();
  32. void create( void* sampler = 0 );
  33. SDL_Surface* inverserPixels(SDL_Surface *imageSource) const;
  34. GLuint getID() const;
  35. void setFichierImage(const std::string &fichierImage);
  36. private:
  37. GLuint m_id;
  38. std::string m_fichierImage;
  39. int m_largeur;
  40. int m_hauteur;
  41. GLenum m_format;
  42. GLenum m_formatInterne;
  43. bool m_textureVide;
  44. };
  45. #endif