OpenGL manages the textures available for texturing. When you want to use a texture, its data should be uploaded to OpenGL.
Because current videocards have limited
memory, not always all textures in an application will fit in the videocard's memory. When you upload every texture to OpenGL
probably textures you don't use at the moment are stored on the videocard while others now needed are not, resulting in stalls in
the rendering. To avoid this, you can do the reverse of DEMOGL_TextureUpload with
DEMOGL_TextureUpload: it will remove the texture data from
OpenGL so it will not get in the way of other textures who will be used. Upload only textures which are needed in the next
frame or in the next few frames. Use PREPARE commands in the script to call Prepare() methods of effectobjects and place calls
to DEMOGL_TextureUpload to time texture uploads efficiently.
DemoGL will use hardware generated mipmaps, when the hardware supports the extension GL_SGIS_generate_mipmap.
DemoGL keeps references to uploaded textures, how many times it's uploaded. When you unupload a texture which is uploaded twice
the texture is not removed from OpenGL but the upload references are decreased with one. When no upload reference exists anymore,
the texture is fysically removed from OpenGL.