After some experience with the current Galactic Engine, I am improving some of the classes used, making them more efficient, easy to use (from both programmers and user perspective).
Here is a texture manager idea, I am going to post it for my own future reference and for other people who may find it useful.
Overall structure:

Maing goals:
- As minimum code as possible
- Texture loading / unloading
- Video parameters changing should not affect loaded textures
The primary class is
Texture Manager. It is static class, but should not be used directly, except when changing video mode. This class takes care of all the work, by adding , removing and refreshing textures.
The
Texture Loader, is another class or library (DevIL for example). Its main goal is to load texture from the file, get memory, and get OpenGL id. That are stored in the
Texture class.
Texture Interface is the class that user code is working with. It supports only these functions that are needed:
- Loading
- Binding
- Unloading
- Refreshing
The implementation of these functions is made in the
Texture class in the
Texture Manager.
A few possible problems:
- One texture used by multiple Texture Interfaces
- Setting new Video mode
- Image missing
The first problem can be solved, by adding a counter to the
Texture class, so that if the
Texture Interface requests already existent texture, then it would increase the counter. If some
Texture Interface is deleted, then counter is decreased. The real
Texture would be deleted only if counter reaches 0.
The second problem can be easily solved by accessing
Texture Manager directly and requesting to Refresh all the
Texture in the list. The Other way is to refresh each
Texture manually through
Texture Interface.
If somehow the image requested for texture is missing, then there isn't really much of a choices to choose from, except using default
Texture. The default
Texture can be created by
Texture Manager, or it can be some other
Texture from the
Texture List.