Stan` Posted May 20, 2018 Report Share Posted May 20, 2018 @elexis I wrote this to check for dubious textures in case that can be of use. from PIL import Image import os def is_power_of_two(n): return (n & (n - 1)) == 0 modList = ["public", "terra_magna"] for mod in modList: listOfFiles = os.walk("E:\\Dev\\0-A-D\\ps\\trunk\\binaries\\data\\mods\\" + mod) for root, directories, filenames in listOfFiles: for filename in filenames: if ".png" in filename: im = Image.open(os.path.join(root,filename)) width, height = im.size if not is_power_of_two(width) or not is_power_of_two(height): print("WARNING: Non power of two file found: " + os.path.join(root,filename)) 1 1 Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted May 20, 2018 Report Share Posted May 20, 2018 As I mentioned problem is not in the texture resolution, but in number of mipmaps. Also we have not only .png textures. Quote Link to comment Share on other sites More sharing options...
Stan` Posted May 20, 2018 Author Report Share Posted May 20, 2018 Yeah but I won't commit DDS. And the one we currently have are fine 15 minutes ago, vladislavbelov said: As I mentioned problem is not in the texture resolution, but in number of mipmaps. Also we have not only .png textures. True and that is defined by the textures XML files. Which by the current look them means we assume they are power of two. The point of the script is not to fix textures its just a check . https://github.com/0ad/0ad/blob/e317fa0d610df3bf624aa326e979b2de7e75729a/source/lib/res/graphics/ogl_tex.cpp According to this there were openGl limitations regarding the size of pictures. 1 Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted May 20, 2018 Report Share Posted May 20, 2018 OpenGL supports such textures since 2.0: https://www.khronos.org/opengl/wiki/NPOT_Texture. I think we need to have NPOT textures for UI, but then pack them into POT atlas. It should be faster and work better. It'd be good to implement after the GUI refactoring. Quote Link to comment Share on other sites More sharing options...
Stan` Posted May 20, 2018 Author Report Share Posted May 20, 2018 4 minutes ago, vladislavbelov said: OpenGL supports such textures since 2.0: https://www.khronos.org/opengl/wiki/NPOT_Texture. I think we need to have NPOT textures for UI, but then pack them into POT atlas. It should be faster and work better. It'd be good to implement after the GUI refactoring. Then I guess It is a remnant of before openGl 2.0. still power of two textures Is good practice and really common. Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted May 20, 2018 Report Share Posted May 20, 2018 3 minutes ago, stanislas69 said: Then I guess It is a remnant of before openGl 2.0. still power of two textures Is good practice and really common. I agree to use POT textures, until we have a better solution. Quote Link to comment Share on other sites More sharing options...
Stan` Posted May 20, 2018 Author Report Share Posted May 20, 2018 Yeah. Quote Link to comment Share on other sites More sharing options...
aeonios Posted May 21, 2018 Report Share Posted May 21, 2018 NPOT doesn't work on ATI. Really it doesn't work well in general, and is not something we should encourage. Packing into an atlas does fix that though. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.