Text disappears after hitting a breakpoint

shenjoku

25-09-2011 02:00:59

If I'm in the middle of debugging code and I hit a breakpoint to go into the debugger then continue running the application all text stops rendering. Does anyone know what is causing this or how to fix it? I've been trying to track it down but I'm getting nowhere. As far as I can tell the texture is fine and the quads are being constructed and rendered perfectly fine but there's still no text showing up. It's really confusing.

shenjoku

30-09-2011 01:46:18

Figured out what the problem is. The cause is the font texture is being cleared and never re-loaded for whatever reason so it's just a completely black texture. I'm not entirely sure why the font texture is getting killed and nothing else is though.

EDIT: Well I figured out one way to fix the problem. I added a simple function to ResourceTrueTypeFont called recreate that destroys the texture then calls ResourceTrueTypeFont::initialise() to recreate the font texture and am calling the function by keyboard input after the problem appears just to test if it fixes the issue and it does. So it seems like all font textures need to be recreated due to whatever is causing this issue, which I'm still unsure of. My first guess is the device is getting lost and re-acquired but I can't figure out if that's really the case or not.

EDIT2: Found the problem. There was a keyboard shortcut leftover from the Ogre tutorials bound to F5 that was calling Ogre::TextureManager::getSingleton().reloadAll(); Which is what was causing all of the texture to be cleared. Even though this is the problem, this still exposes a major issue with fonts; if you ever need to reload the textures then all fonts will be dead without any way to reload them. At least I don't know of and can't find any methods for reloading font textures other than the one I added manually.