My previous patch (2977469 - Resize capability for viewer.py) introduced the following problem: on Windows, when using textured objects,
the texture disappears after resizing the window. On Linux, the same textures work fine.
It seems to be a Pygame/SDL problem, since some implementations (especially the Win32 one) destroy and recreate the OpenGL context when resizing
the window. After this, all the textures and display lists used in OpenGL code will have to be reloaded.
Here are some links with discussions on this problem:
This fix tests whether the texture is still valid, using glIsTexture(...) in glmaterial.cpp.
If it is not, it means OpenGL context was recreated, and a texture reload is scheduled automatically.
Therefore, user programs do not have to worry about OpenGL context recreation and should work unmodified.
If cgkit uses textures or display lists in other places, a similar fix should be applied.