21 #ifndef Tulip_GLTEXTUREMANAGER_H
22 #define Tulip_GLTEXTUREMANAGER_H
24 #include <tulip/tulipconf.h>
30 #if defined(__APPLE__)
31 #include <OpenGL/gl.h>
46 unsigned int spriteNumber;
52 class TLP_GL_SCOPE GlTextureManager {
54 typedef std::map<std::string,GlTexture> TextureUnit;
55 typedef std::map<unsigned long,TextureUnit> ContextAndTextureMap;
62 static void createInst();
66 static GlTextureManager &getInst() {
68 inst=
new GlTextureManager();
76 void changeContext(
unsigned long context);
80 void removeContext(
unsigned long context);
85 GlTexture getTextureInfo(
const std::string&);
90 bool existsTexture(
const std::string& filename);
94 bool loadTexture(
const std::string&);
98 void deleteTexture(
const std::string &);
102 void beginNewTexture(
const std::string&);
106 bool activateTexture(
const std::string&,
unsigned int);
110 bool activateTexture(
const std::string&);
114 void desactivateTexture();
118 void setAnimationFrame(
unsigned int id) {
124 unsigned int getAnimationFrame() {
125 return animationFrame;
130 void clearErrorVector() {
131 texturesWithError.clear();
136 void removeEntryOfErrorVector(
const std::string &name) {
137 texturesWithError.erase(name);
144 void registerExternalTexture(
const std::string &textureName,
const GLuint textureId);
153 static GlTextureManager* inst;
155 unsigned long currentContext;
157 ContextAndTextureMap texturesMap;
158 std::set<std::string> texturesWithError;
160 unsigned int animationFrame;
166 #endif // Tulip_GLTEXTUREMANAGER_H