Case sensitivity causes loading same texture twice

Problems building or running the engine, queries about how to use features etc.
Post Reply
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Case sensitivity causes loading same texture twice

Post by Oogst » Fri Aug 04, 2017 1:49 pm

I've noticed that if I set the same texture twice but with different casing, then the texture will be loaded twice. Or at least the loading time will happen twice. So if I do this, I get loading time twice:

Code: Select all

textureUnitStateA->setTextureName("Banana.tga");
textureUnitStateB->setTextureName("banana.tga");
However, if I use the same case then only the first call incurs loading time, as expected:

Code: Select all

textureUnitStateA->setTextureName("banana.tga");
textureUnitStateB->setTextureName("banana.tga");
This is on Windows in Ogre 1.9RC. Has this behaviour changed since then?

I can imagine this makes sense on Linux/Mac where the file system is case sensitive, but on Windows Ogre is simply loading the exact same texture twice. Is there some way to fix this? I don't know whether under the hood the memory is also used twice or whether it just reloads and overwrites the previous texture.

My current workaround for this behaviour is to just always convert my texture names to lower case before sending them to Ogre. However, this requires that I think of this at all times, so it's a rather bug-prone solution.
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

paroj
OGRE Team Member
OGRE Team Member
Posts: 620
Joined: Sun Mar 30, 2014 2:51 pm
x 86
Contact:

Re: Case sensitivity causes loading same texture twice

Post by paroj » Fri Aug 04, 2017 2:13 pm

Oogst wrote: My current workaround for this behaviour is to just always convert my texture names to lower case before sending them to Ogre. However, this requires that I think of this at all times, so it's a rather bug-prone solution.
This is exactly what Ogre would do:
https://github.com/OGRECave/ogre/blob/b ... .cpp#L1852

you could check if your archive returns false for isCaseSensitive() as it should:
https://github.com/OGRECave/ogre/blob/m ... em.cpp#L71

anyway with 1.10 Ogre case insensitivity is deprecated:
https://github.com/OGRECave/ogre/blob/m ... trict-mode

besides performance, the idea is that Ogre should promote cross-platform compatibility.
0 x

Oogst
OGRE Expert User
OGRE Expert User
Posts: 1034
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
Contact:

Re: Case sensitivity causes loading same texture twice

Post by Oogst » Fri Aug 04, 2017 5:33 pm

Thanks for clearing up how it's intended in Ogre! :)
paroj wrote:...
anyway with 1.10 Ogre case insensitivity is deprecated:
https://github.com/OGRECave/ogre/blob/m ... trict-mode

besides performance, the idea is that Ogre should promote cross-platform compatibility.
I guess an engine shouldn't change it's policy randomly over the years, but I do disagree with this choice pretty strongly. Over the years I've run into so many bugs due to case sensitivity that at my company we now have the basic rule that nothing should ever be case sensitive. It's just super confusing for humans to work with, especially when working in a larger team with artists and designers.

It's possible for an engine to be cross-platform compatible without being case sensitive. The engine we've made for Awesomenauts and Swords & Soldiers runs on PC/Mac/Linux/PS3/PS4/360/X1/Wii/WiiU/iOS/Android and files are not case sensitive. However, this does mean either doing a lookup to correct case sensitivity, or removing all casing during the asset build process.

Anyway, thanks again for explaining how it works in Ogre! :)
0 x
blog.oogst3d.net: my dev blog and portfolio
Ronimo Games: my game dev company
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/PS3/PS4)
Swords & Soldiers: side-scrolling RTS (PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance

Post Reply