Jump to content

Texture Load


Roberto14
 Share

Recommended Posts

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 );
}

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

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.

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

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...

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

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.

  • Upvote 2

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

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.

  • Upvote 4

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

  • 2 weeks later...

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.

  • Upvote 5

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

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

Link to comment
Share on other sites

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)

  • Upvote 2

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

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.

  • Upvote 1

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

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,

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

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 :P

  • Upvote 1

My Leadwerks games!

https://ragingmages.itch.io/

Link to comment
Share on other sites

  • 4 weeks later...

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.

  • Upvote 1

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

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.

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...