Roberto14 Posted November 12, 2016 Share Posted November 12, 2016 Hi all guys, i have a simply question: How can i create/load a texture with a format specified by me/user?? I want to load some texture in my world, and because i have created a quality settings specific for this set of texture, i want my program load them with user specified format, for example: vector< Texture * > vTextures; vector< string > vTexList = GetTexList(); for ( TexPath : vTexList ) { int Q = TexQuality(); int iTexFormat = 0; if ( Q == 0 ) iTexFormat = RGBADXT5n; // max compression, and lower qaulity ( really save mem ) if ( Q == 4 ) iTexFormat = ?? RGBA ??; // no compession, max quality, ( big mem usage ) Texture *pTexture = ?? Which load procedure, or creation from PNg, in my case, i have to use? vTexture.push_back( pTexture ); } Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA Link to comment Share on other sites More sharing options...
gamecreator Posted November 12, 2016 Share Posted November 12, 2016 Have you looked at the texture functions? Quote Link to comment Share on other sites More sharing options...
Roberto14 Posted November 12, 2016 Author Share Posted November 12, 2016 Have you looked at the texture functions? Yes but i'm talking of pre setting the right configs at load time, infact i can only get format once tex is loaded. I don't know if is possible... Otherwise i have to load image file with third party code, get pixels, and create and fill a new tex manually, but load increase too much, i'm talking abount 40-50 PNg files with 1024x1024 res, 32bit. Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA Link to comment Share on other sites More sharing options...
Roberto14 Posted November 13, 2016 Author Share Posted November 13, 2016 I have to think so that there is no way to change the format of a texture, both when loading that once loaded !? How can i give user the possibility to change texture quality, in-game? I just have to give this option only for some textures, manually loaded in my code... Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA Link to comment Share on other sites More sharing options...
Josh Posted November 16, 2016 Share Posted November 16, 2016 Textures are already stored in compressed or uncompressed format, which makes for fast loading straight into video memory. This cannot be changed. You can change the format in the texture editor: http://www.leadwerks.com/werkspace/page/tutorials/_/textures-r6 You would not want to have a quality setting based on the compression format, but a texture resolution setting would be useful. I actually thought we had this, but I checked and we don't. This will skip the highest-resolution mipmap when "medium" quality is used, and skip the highest two resolution mipmaps when "low" is used. Will not be hard to add. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted November 16, 2016 Share Posted November 16, 2016 You would not want to have a quality setting based on the compression format, but a texture resolution setting would be useful. I actually thought we had this, but I checked and we don't. This will skip the highest-resolution mipmap when "medium" quality is used, and skip the highest two resolution mipmaps when "low" is used. Will not be hard to add. Yep, we had it in LE2 but it was missing in LE3. In LE2, it was a global setting: SetTextureQuality C++: void Engine::SetTextureQuality( int quality ) BlitzMax: SetTextureQuality( quality:Int ) Sets the quality of loaded textures. If quality is one, textures will be loaded at full resolution. If quality is two, textures will be loaded at half resolution. If quality is three, textures will be loaded at one-fourth resolution. .dds files must contain mipmaps for this setting to have an effect. 4 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted November 28, 2016 Share Posted November 28, 2016 This will be in the next build: Texture::SetQuality(int quality) 0: Highest 1: Medium 2: Low 3, 4, 5...: Even lower GUI textures should not have mipmaps, in order to keep them at max resolution. 5 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted November 28, 2016 Share Posted November 28, 2016 Is this a global setting or per texture? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted November 28, 2016 Share Posted November 28, 2016 global, and you can change it on the fly. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted November 28, 2016 Share Posted November 28, 2016 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
gamecreator Posted November 29, 2016 Share Posted November 29, 2016 I know I risk getting hurt since I know you don't like people who keep asking for more features but any chance this would make it easier for you to implement streaming textures or whatever it's called. You know, when the game starts playing but the textures keep loading to higher and higher res to save loading times before the game? I'm not holding my breath but since it's related and maybe this makes that feature easier to implement. It would be a really strong bullet point for the engine: Streaming Textures Quote Link to comment Share on other sites More sharing options...
Josh Posted November 29, 2016 Share Posted November 29, 2016 It's already supported, unofficially. Texture::SetLoadingMode(mode) 0: default 1: deferred 2: managed (will actually delete textures out of memory when not used for a while, not sure if this is a good idea) 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted November 29, 2016 Share Posted November 29, 2016 Oh dang! I like it!! Does this mean that if you call that function and then load a map, the map loading process will do this too? Quote Link to comment Share on other sites More sharing options...
Josh Posted November 29, 2016 Share Posted November 29, 2016 Yes, any texture that gets loaded. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted November 29, 2016 Share Posted November 29, 2016 I hope one day SetLoadingMode is supported. Would be nice to have hud textures work properly. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted November 29, 2016 Share Posted November 29, 2016 I hope one day SetLoadingMode is supported. Would be nice to have hud textures work properly.[/font][/color] How do you envision these working? Textures with no mipmaps are unaffected. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted November 29, 2016 Share Posted November 29, 2016 Oh right, cause HUD textures are not suppose to have mipmaps. However, if a HUD texture does have mipmaps (for example, the advanced first person shooter crosshair), it'll remain pixelated. I'll give it another go in the future. Thanks, Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
DooMAGE Posted November 30, 2016 Share Posted November 30, 2016 It's already supported, unofficially. Texture::SetLoadingMode(mode) 0: default 1: deferred 2: managed (will actually delete textures out of memory when not used for a while, not sure if this is a good idea) This is related to this? http://www.leadwerks.com/werkspace/topic/9840-deferred-texture-loading/page__hl__managed I'll try to use this more often 1 Quote My Leadwerks games! https://ragingmages.itch.io/ Link to comment Share on other sites More sharing options...
gamecreator Posted November 30, 2016 Share Posted November 30, 2016 Huh, completely forgot that this was a thing 2.5 years ago. Quote Link to comment Share on other sites More sharing options...
Roberto14 Posted December 26, 2016 Author Share Posted December 26, 2016 Any news about this?? Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA Link to comment Share on other sites More sharing options...
Josh Posted December 26, 2016 Share Posted December 26, 2016 Texture::SetDetail(const int detail) 0 is full res. 1 is half res. 2 is 1/4 res etc. This works by skipping higher-resolution mipmaps when textures are loaded. If you don't want a texture to appear blurry, like for a GUI item, set it to not have mipmaps. Please let me know how that works for you. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Roberto14 Posted December 27, 2016 Author Share Posted December 27, 2016 First of all Josh really thank you for the intervention, i appreciate your interest for this. I have to say that load times are almost the same but memory used is less than before. My game is a small project, but i think this option will help much other users, with games bigger than me. Quote I'm not english, so please sorry for my grammatical errors I'm using Leadwerks and can programm in C++ and LUA 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.
Note: Your post will require moderator approval before it will be visible.