Page 1 of 1

Texture naming confusion

Posted: Fri Jun 20, 2008 7:13 pm
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.

Posted: Fri Jun 20, 2008 8:24 pm
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.

Posted: Sat Jun 21, 2008 7:36 am
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.

Posted: Sat Jun 21, 2008 12:27 pm
by rogerborg
Do you think it's worth your time to code that up?

Posted: Sat Jun 21, 2008 9:30 pm
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?