Android resources after puse/resume

AlekseevAV

25-05-2017 15:03:25

I'm using Ogre-1.9 and newest MyGUI, downloaded from github.com.
I've built them for android, but have a problem: After calling functions Ogre::AndroidEGLWindow::_destroyInternalResources on pause Androids' event and Ogre::AndroidEGLWindow::_createInternalResources on resume, all textures in mygui becomes black.(all buttons and panels are black, but text on them looks fine) But texture is black only at first time.
If I call these functions the second time, the third time and so on, textures are correct.
So, this is my work around on resume function(I call _createInternalResources two times):
static_cast<Ogre::AndroidEGLWindow*>(mWnd)->_createInternalResources((ANativeWindow*) hwndvoid, nullptr);
static_cast<Ogre::AndroidEGLWindow*>(mWnd)->_destroyInternalResources();
static_cast<Ogre::AndroidEGLWindow*>(mWnd)->_createInternalResources((ANativeWindow*) hwndvoid, nullptr);


I've tried Ogre-1.10, but I had the same problem. I've tried to apply texture to an entity, and it's works ok, so I think that ogre resources work nice.
Now, it work, but with work around. How can I fix the problem?

I've call(for test) the code after mygui init:
static_cast<Ogre::AndroidEGLWindow*>(mWnd)->_destroyInternalResources();
static_cast<Ogre::AndroidEGLWindow*>(mWnd)->_createInternalResources((ANativeWindow*) hwndvoid, nullptr);

And all elements become black.

There was a similar problem in the forum, but it's about fonts, and now fonts work correct. http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=30346

Altren

09-06-2017 01:22:02

This looks odd, font issue happened because we created those textures manually and such thing never happened for me with textures, that are handled by Ogre.
Could you try to use similar solution for ordinary textures?
There is OgreTexture::loadResource in OgrePlatform/src/MyGUI_OgreTexture.cpp, try to update some stuff, for example set mTexture to something from Ogre::TextureManager.