lindenrty
26-11-2014 14:20:28
Ogre 1.9 + MyGUI3.20 + NDK-r9d + Android 4.0(OpenGLES1.0 ,TrueTypeFont )
hi,any body find this problem?
1.launch the application( Android NativeActivity).
=> has some button (attachment before.png)
2.touch mobile's [home] button.
3.resume application.
=>it looks perfect except text (attachment after.png)
i'm sorry ,my english is very bed.
could you give me some advise?
thank you for read this.
Hello! Have same problem..
Who knows a simple way how to fix it?
In fact, in my case the font textures destroyed after app hide to tray and resume again:
[attachment=0]p8PH3NArpew.jpg[/attachment]
In Android cmd_handle I just notify Ogre window about native android app window terminating and recreating :
APP_CMD_TERM_WINDOW:
static_cast<Ogre::AndroidEGLWindow*>(getWindow())->_destroyInternalResources();
APP_CMD_INIT_WINDOW:
static_cast<Ogre::AndroidEGLWindow*>(getWindow())->_createInternalResources(app->window, config);
P.S. Ogre 1.9(OpenGLES2.0) + MyGUI3.20 + NDK + Android 4.4.4
Found some fast solution in this way:
Index: thirdParty/MyGUI/MyGUIEngine/include/MyGUI_ResourceTrueTypeFont.h
===================================================================
--- thirdParty/MyGUI/MyGUIEngine/include/MyGUI_ResourceTrueTypeFont.h (revision 306)
+++ thirdParty/MyGUI/MyGUIEngine/include/MyGUI_ResourceTrueTypeFont.h (working copy)
@@ -35,7 +35,7 @@
{
class MYGUI_EXPORT ResourceTrueTypeFont :
- public IFont
+ public IFont, public ITextureInvalidateListener
{
MYGUI_RTTI_DERIVED( ResourceTrueTypeFont )
@@ -62,6 +62,8 @@
// code point is FontCodeType::NotDefined, but it can be customized in the font definition file.
Char getSubstituteCodePoint() const;
+ virtual void textureInvalidate(ITexture* _texture);
+
private:
void addCodePoint(Char _codePoint);
void removeCodePoint(Char _codePoint);
Index: thirdParty/MyGUI/MyGUIEngine/src/MyGUI_ResourceTrueTypeFont.cpp
===================================================================
--- thirdParty/MyGUI/MyGUIEngine/src/MyGUI_ResourceTrueTypeFont.cpp (revision 306)
+++ thirdParty/MyGUI/MyGUIEngine/src/MyGUI_ResourceTrueTypeFont.cpp (working copy)
@@ -655,9 +655,18 @@
// Create the texture and render the glyphs onto it.
//-------------------------------------------------------------------//
- mTexture = RenderManager::getInstance().createTexture(MyGUI::utility::toString((size_t)this, "_TrueTypeFont"));
-
- mTexture->createManual(texWidth, texHeight, TextureUsage::Static | TextureUsage::Write, Pixel<LAMode>::getFormat());
+ if( !mTexture )
+ {
+ mTexture = RenderManager::getInstance().createTexture(MyGUI::utility::toString((size_t)this, "_TrueTypeFont"));
+ }
+ else
+ {
+ mTexture->destroy();
+ }
+
+ mTexture->setInvalidateListener(nullptr);
+ mTexture->createManual(texWidth, texHeight, TextureUsage::Static | TextureUsage::Write, Pixel<LAMode>::getFormat());
+ mTexture->setInvalidateListener(this);
uint8* texBuffer = static_cast<uint8*>(mTexture->lock(TextureUsage::Write));
@@ -958,6 +967,12 @@
if (width > 0)
_texX += mGlyphSpacing + width;
}
+
+ void ResourceTrueTypeFont::textureInvalidate(ITexture* _texture)
+ {
+ mGlyphMap.clear();
+ initialise();
+ }
#endif // MYGUI_USE_FREETYPE
Altren
20-03-2015 23:58:17
Looks correct. Could you create pull request at github please.
Looks correct. Could you create pull request at github please.
Ooh...

Sorry, ashamed to admit my incompetence, but I never used Git... Only SVN..
Altren
21-03-2015 22:51:12
Ok, I'll apply patch myself. Thank you for contribution.