DarkRadiant GLTextureManager: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
 
mNo edit summary
Line 10: Line 10:
                       eTextureType textureType);
                       eTextureType textureType);


The GLTextureManager does not load the textures itself, but requests them to be passed 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 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).
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).

Revision as of 07:20, 10 February 2007

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).

Post-Processing

Fallback (default) Textures