12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef DEF_TEXTURE
- #define DEF_TEXTURE
- // Include Windows
- #ifdef WIN32
- #include <GL/glew.h>
- #include <SDL2/SDL_image.h>
- // Include Mac
- #elif __APPLE__
- #define GL3_PROTOTYPES 1
- #include <OpenGL/gl3.h>
- #include <SDL2_image/SDL_image.h>
- // Include UNIX/Linux
- #else
- #define GL3_PROTOTYPES 1
- #include <GLES3/gl3.h>
- #endif
- // Autres includes
- #include <SDL2/SDL.h>
- #include <iostream>
- #include <string>
- // Classe Textures
- class Texture
- {
- public:
- Texture();
- Texture(std::string fichierImage);
- Texture(int largeur, int hauteur, GLenum format = GL_RGBA, GLenum formatInterne = GL_RGBA, bool textureVide = true);
- Texture(Texture const &autre);
- ~Texture();
- Texture& operator=(Texture const &autre);
- bool createTexture();
- void create( void* sampler = 0 );
- SDL_Surface* inverserPixels(SDL_Surface *imageSource) const;
- GLuint getID() const;
- void setFichierImage(const std::string &fichierImage);
- private:
- GLuint m_id;
- std::string m_fichierImage;
- int m_largeur;
- int m_hauteur;
- GLenum m_format;
- GLenum m_formatInterne;
- bool m_textureVide;
- };
- #endif
|