I want to make it possible to changing the screen resolution from inside the game. I was hoping there was a way of doing this without destroying the GL context, but apparently it’s impossible
So I’ll have to reload all the textures and other data like vbos, after changing resolution. But what is the best way of reloading the data?
I can think of three ways of doing it. The obvious way is to reload all the textures the same way as when the game was started. But it would take ages, because images has to be extracted from a jar, then decompressed into an array before it can be sent to GL. Not all textures are originally stored as images in a file. Some are generated or stored in other ways wich makes it difficult to reload the textures without restarting the whole game.
To avoid the problems of the first method I thought I could cache the textures on disk. Performance is improved by mem-mapping the data directly to a native buffer. There is also less difficult to find out wich file goes with wich texture.
The third method is to load the textures from the gfx card to main memory using glGetTexImage, before context is destroyed. Is by far the easiest way and probably the fastest. Would use tons of memory though.
Any idees or suggestions on how to solve this?