Simple Textures and Memory question

Hello!



This might be a stupid question, but I don’t know the answer, so meh :stuck_out_tongue:



Let’s suppose there’s an object, and it has a material and a texture for the material. All fine and dandy. Now suppose we want to make another of this object that is similar, with the same material and texture, but maybe different in some other way. On creation, would it be wise to reuse the material from the first object with the texture, or just an entirely new material with the same texture?



The reason I’m asking is that I’m thinking ahead of the future of one of my entity loaders and I got to thinking if I’m creating a bunch of barrels lets say, that the way I have it psudeocoded now has it loading the texture over and over again. I’m thinking I’d be wasting a ton of memory this way…



~FlaH

Textures are automatically shared when they have been loaded from the assetManager, thats why they have to have absolute paths.

Hello again!



Oh, so if I call a material to have a texture at “foo/bar/texture.png” and I make another object and say it has a texture at “foo/bar/texture.png” too (same file path), that the assetManager automatically knows it’s the same texture? That’s pretty awesome/convenient :smiley:



Cheers!

~FlaH

Yep :slight_smile:

1 Like