Texture naming confusion

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
Xplod
Posts: 32
Joined: Sat Mar 29, 2008 5:48 pm
Contact:

Texture naming confusion

Post by Xplod »

Hi all,

I just found a small bug in texture loading.
Try to load a file named : "sword.tga.png". It's originally a PNG file, but Irrlicht will recognize it as a TGA file (Unsupported TGA format).

I think the bug is that the texture extension is checked after the FIRST dot, and not before the LAST dot.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, that's correct. I started to use better checks in some places, but I'll have to make it in a structured way in all places.
Xplod
Posts: 32
Joined: Sat Mar 29, 2008 5:48 pm
Contact:

Post by Xplod »

I think it would be also better to read files header, so you can name PNG, TGA, BMP, ... files like "MyTexture.texture" and it will be automatically loaded correctly.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Do you think it's worth your time to code that up?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The image loaders already do this. But only if the extension recognition did not work or if those tries did fail to load the image. So it seems that the tga loader indeed returns something and the other tests are not done. Maybe you could debug if it is indeed the tga loader which returns an image?
Post Reply