Page 1 of 1

Android suspend lose GL context

Posted: Fri Nov 15, 2013 6:44 pm
by aoikonom
Using Ogre 1.8 on Android.

When application loses focus gl context is destroyed and after resume I only see black screen.

This is described in Android documentation here http://developer.android.com/reference/ ... derer.html
EGL Context Lost

There are situations where the EGL rendering context will be lost. This typically happens when device wakes up after going to sleep. When the EGL context is lost, all OpenGL resources (such as textures) that are associated with that context will be automatically deleted. In order to keep rendering correctly, a renderer must recreate any lost resources that it still needs. The onSurfaceCreated(GL10, EGLConfig) method is a convenient place to do this.
How can handle this situation with Ogre?

Re: Android suspend lose GL context

Posted: Fri Nov 15, 2013 6:50 pm
by Wolfmanfx
Hi,

Yes we can handle that! But not in 1.8 switch to 1.9 and take a look at the samples.

Re: Android suspend lose GL context

Posted: Sun Nov 17, 2013 10:45 pm
by aoikonom
Wolfmanfx, thanks for replying.

Could you indicate me in which files-points this functionality is implemented, so that I can add it to version 1.8?

This is because, I don't use Ogre as it is, but a port of Ogre to Maramalade, which was branched from version 1.8 and on which I have made some changes. So I don't know if it is better to try to make a port of 1.9 to marmalade based on previous port, or apply specific changes to the port I have, related to the problem with GL context on Android devices.

Re: Android suspend lose GL context

Posted: Sun Nov 17, 2013 10:49 pm
by Wolfmanfx
You port to 1.9 - 1.8 has many bugs inside. With 1.9 you get many fixes not just on android also we have new features like WP8 support and many many things. So go ahead and port :)

Re: Android suspend lose GL context

Posted: Wed Dec 11, 2013 7:18 pm
by aoikonom
Can you please inform me how does Ogre 1.9 handle problem with Android GL context ? Does it keep a copy of all GL resources in RAM?
Because if this is the case I might have a problem with RAM consumption.

Also I have a problem porting my project to Ogre 1.9 found here http://www.ogre3d.org/forums/viewtopic.php?f=1&t=79709

Re: Android suspend lose GL context

Posted: Wed Dec 11, 2013 7:41 pm
by Wolfmanfx
No infact we release all gpu resources when device is lost and recreate the gpu resources when the device is active again. Of course the meshdata is kept inside sysram otherwise it would not possible to recreate the resources fast.
Infact the context lost can also happen when you rotate the device.

Re: Android suspend lose GL context

Posted: Wed Dec 11, 2013 11:13 pm
by aoikonom
Textures for example are kept in memory?

Re: Android suspend lose GL context

Posted: Mon Mar 03, 2014 10:45 am
by Wolfmanfx
Sorry for the late replay - Textures can freed completely to save memory as long there are not referenced somewhere.