I have a program which potentially uses a lot of texture memory.
For this reason, it only loads the mipmap levels it actually needs, and then can load the larger mipmap levels as they are needed. The problem is how to delete them when they are no longer needed.
I am currently using glTexImage2D with width and height of 0, and NULL data to free the unused levels. Is this standards compliant? Is there a way to verify this works? Would it be better to use a width and height of 2? Are there other ways to do this?
You might like to look at ARB_sparse_texture - although it is not available on all hardware
It seems the only portable ways to do this have performance penalties.
I could for example, copy the needed mipmaps I want to keep to a new texture using framebuffers.
I could manually apply mipmapping. This requires a texture for each mipmap level, and then multi texturing to blend the two needed mipmap levels when rendering.
Does anyone know of a better alternative? Which of the above is likely a better method in terms of performance?