Forums

Full Version: Texture Scaling
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It's become apparent that we need to let some users either switch to a set of lower resolution textures or have an option that scales them down in the game. The biggest problem with this that Joe has pointed out is that we'd need to reload all the textures after they're scaled.
Not a problem, really, just an additional feature that'll be required if we want this to happen without having to restart the game. And I think we need to have a lower res texture set (rather than scaling them down at runtime) because of the additional complexity of scaling them down (not to mention the time required to do that).
I could make a set of low-res textures, this is going to add several more megabytes to our packages' file size...
Got to be done....
OK, I've found at least one person for whom the game crashes because it can't load our 1024x1024 font texture. Reducing it to 512x512 makes it work.In order to fix this I think we need to reorganize our textures. First of all we need to put data/tex/ and data/textures/ together and organize them a little better. This will be a pain in the butt but we might as well just get it over with.Then the directory structure could be like this:data/textures/large/data/textures/medium/data/textures/small/Under each of the size category directories the structure might be something like this:gui/hud/icons/smoke/track/weather/This will change quite a few paths in the code...maybe I'll work on this a little tonight.
I just finished phase one of this process. I moved all the textures around as mentioned above. I also added the menu entry and config file setting for it...things I still need to do:* finish up the code for the menu* copy existing texture set into "large" subdir, copy into "medium", and "small" subdirs and scale textures down* create wrapper for IMG_Load like UTILITY::TexLoad, that is aware of the data path and the texture size setting - maybe UTILITY::SDLTexLoad()?* replace IMG_Load()s throughout code with wrapper function* add support for texture size to the TexLoad function* rename TexLoad() GLTexLoad() for clarity?* figure out some way to make texture size setting work for tracks which have hard paths to images in the track files...
Phase 2 is done...Now in data/textures/ there is a large, medium and small subdir. In data/textures/medium/ no texture exceeds 256x256 and in data/textures/small/ there are none bigger than 128x128. The only exception is newfontt3.png which is 512x512 in textures/medium/ and 256x256 in textures/small/ because otherwise, the text is illegible at small texture size. You can switch between these texture sets by chaning your options in the menu, but you must restart to reload the textures.Left to do:* create SDLTexLoad() wrapper for IMG_Load like UTILITY::TexLoad, that is aware of the data path and the texture size settings, replace IMG_Load()s throughout code with wrapper function* rename TexLoad() GLTexLoad() for clarity, replace throughout code* figure out some way to make texture size setting work for tracks which have hard paths to images in the track files... - right now these are hard-coded to "large" in the track files.* something else I thought of: make the TexLoad function fall back to the next-lower texture size level for a texture that doesn't exist. this way we can delete most of the really small textures from textures/medium/ and textures/large/ and avoid redundant files.
Now all the cars have scaled down textures which are set using the texture_size setting as well.
The other stuff I mentioned that needs to be done will not be in this release, it will probably be in the next release, along with reloading the textures after a texture size change.