DarkRadiant GLTextureManager
From The DarkMod Wiki
The GLTextureManager has these tasks:
- Instantiate/Realise Textures and load them into OpenGL when requested.
- Deliver the fallback textures ("shader image missing", black specular, flat bump, etc.) if the load failed.
- Image Post-Processing like resampling, gamma-correction.
Realisation / Binding
To request a binding, the Shader objects call the GLTextureManager::getBinding method:
TexturePtr getBinding(const std::string& textureKey, TextureConstructorPtr constructor, eTextureType textureType);
The GLTextureManager does not load the textures itself, but requests them to be created/loaded from the passed TextureConstructor. This way the GLTextureManager doesn't need to take care of how the images are constructed (they may be the result of a addnormals() mapexpression).
The texture is post-processed (see below) and loaded into OpenGL. The according Texture structure is allocated, saved and its pointer returned to the Shader object (which itself returns the pointer to the Renderer, that originally requested the Texture from the Shader).