21 #ifndef Tulip_GLTEXTUREMANAGER_H
22 #define Tulip_GLTEXTUREMANAGER_H
24 #include <tulip/tulipconf.h>
30 #if defined(__APPLE__)
31 #include <OpenGL/gl.h>
48 unsigned int spriteNumber;
54 class TLP_GL_SCOPE GlTextureManager {
56 typedef std::map<std::string,GlTexture> TextureUnit;
57 typedef std::map<uintptr_t,TextureUnit> ContextAndTextureMap;
64 static void createInst();
68 static GlTextureManager &getInst() {
70 inst=
new GlTextureManager();
78 void changeContext(uintptr_t context);
82 void removeContext(uintptr_t context);
87 GlTexture getTextureInfo(
const std::string&);
92 bool existsTexture(
const std::string& filename);
96 bool loadTexture(
const std::string&);
100 void deleteTexture(
const std::string &);
104 void beginNewTexture(
const std::string&);
108 bool activateTexture(
const std::string&,
unsigned int);
112 bool activateTexture(
const std::string&);
116 void desactivateTexture();
120 void setAnimationFrame(
unsigned int id) {
126 unsigned int getAnimationFrame() {
127 return animationFrame;
132 void clearErrorVector() {
133 texturesWithError.clear();
138 void removeEntryOfErrorVector(
const std::string &name) {
139 texturesWithError.erase(name);
146 void registerExternalTexture(
const std::string &textureName,
const GLuint textureId);
155 static GlTextureManager* inst;
157 uintptr_t currentContext;
159 ContextAndTextureMap texturesMap;
160 std::set<std::string> texturesWithError;
162 unsigned int animationFrame;
168 #endif // Tulip_GLTEXTUREMANAGER_H