Bug in loading 2 textures with the same name

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Panther
Posts: 34
Joined: Tue Jun 06, 2006 1:05 am

Bug in loading 2 textures with the same name

Post by Panther »

It looks like Irrlicht has a bug where, when loading a second object with the same texture filename as one that is already loaded, it uses the already-loaded texture, and not the new one. For example, if you load an object called "taxi.3ds" that has a blue texture called "color.tga", then you load another object, from a different directory, called "taxi.3ds", and it has a red texture called "color.tga" (this color.tga file is a different color than the aforementioned one). Then BOTH taxi objects will appear blue in the engine. (You would expect that one would be blue and the other red).

Code: Select all

_chdir("C:\\irrlicht-1.0\\examples\\RaceGame\\Objects\\Taxi_Blue");
scene::IAnimatedMesh* meshCar = smgr->getMesh("taxi.3ds");
car1 = smgr->addOctTreeSceneNode(meshCar);

_chdir("C:\\irrlicht-1.0\\examples\\RaceGame\\Objects\\Taxi_Red");
scene::IAnimatedMesh* meshCar2 = smgr->getMesh("taxi.3ds");
car2 = smgr->addOctTreeSceneNode(meshCar2);

A work-around is to edit the object, and change the names.
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Post by gfxstyler »

i bet this is because of irrlichts resource management, it checks the 2 texture strings to see if they are equal (to prevent loading the same texture several times)

a solution would be to check the texture strings and the texture data to see if they equal, but thats a little slower i guess.

bye!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The name check just has to use absolute file names to avoid this (since the file has to be located in different directories just as in the example - toherwise it wouldn't be diefferent at all).
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Should be fixed in SVN 1673. Test app.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

... And I was actually using that "bug" as a feature... *sigh*
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

What are your requirements? I'm sure we can unfix it enough to meet them. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Heh, don't worry, I'll just adapt it ^^
I was simply making dynamic loading at startup, using the name of the files as identifier, and thus using the directory winding order as a way to override default files and such ^^

I can manage to emulate that easily, just a few more lines :P
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should be able to use zip files, at least if everything is still working. When adding the zip file it should be placed into some distinct directory and the absolute filename should be created accordingly. If not, this has to be fixed...
So having a path /a/b/c/file and a zipfile containing c/file should allow for an override of the former by the latter by loading from the zipfile in directory /a/b
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Hmmm, thanks, that seems like a good temporary solution, but I'm betting that when the archives' loading interfaces will be updated/improved, that'll be the next thing to go ;) Anyway, it's not too bad to just make a check to see if the file is already loaded and if so, just unload and load the new ^^

(In fact, I probably should have done so in the beginning :P I guess I'm just lazy ;) )

Thank you both for your attention :)
Post Reply