I've run into a problem using Irrlicht's font class, the examples show that when you are finished with it you call its drop() function.
However, when I do this and then later in my program ask the engine for the same font, it will return me a pointer pointing to garbage and cause my program to crash.
With textures there seems to be a function called removeTexture() so that the engine knows it's been deleted, but I can't find a function like this for fonts.
Can anyone help me please
Font
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
There's no such thing ATM. Even the patch in the tracker doesn't always work as expected, due to internal changes of the engine. However, a proper usage of drop should always lead to a working app. Moreover, the mem doesn't really leak, it's just not freed completely (but still some internal pointers do know about this issue). So unless you use hundreds of fonts you shouldn't notice this problem.
-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: Font
Uh, I'm having a bad Monday: which example shows calling drop() on a font?Aspiring wrote:I've run into a problem using Irrlicht's font class, the examples show that when you are finished with it you call its drop() function.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
the font's texture is loaded by the driver as you'd load a normal texture and it doesn't seem to be removed, so maybe try removeTexture(font filename) after you drop it... although that may not be safe unless it's actually deleted by the drop...
although that shouldn't actually stop it from being reloaded as the texture cache should provide it...
although that shouldn't actually stop it from being reloaded as the texture cache should provide it...
-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Uh...JP wrote:the font's texture is loaded by the driver as you'd load a normal texture and it doesn't seem to be removed, so maybe try removeTexture(font filename) after you drop it... although that may not be safe unless it's actually deleted by the drop...
although that shouldn't actually stop it from being reloaded as the texture cache should provide it...
1) Don't drop() it. Fonts are "add", not "create".
2) There's no method to remove a texture by name. You can however retrieve the texture by name and remove it.
Code: Select all
gui::IGUIFont * bigFont = smgr->getGUIEnvironment()->getFont("../../media/bigfont.png");
video::ITexture * fontTexture = driver->getTexture("../../media/bigfont.png");
driver->removeTexture(fontTexture);
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
