Android suspend lose GL context

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
aoikonom
Gnoblar
Posts: 23
Joined: Tue Aug 07, 2012 11:05 am

Android suspend lose GL context

Post by aoikonom » Fri Nov 15, 2013 6:44 pm

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?
0 x

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 1
Contact:

Re: Android suspend lose GL context

Post by Wolfmanfx » Fri Nov 15, 2013 6:50 pm

Hi,

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

aoikonom
Gnoblar
Posts: 23
Joined: Tue Aug 07, 2012 11:05 am

Re: Android suspend lose GL context

Post by aoikonom » Sun Nov 17, 2013 10:45 pm

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.
0 x

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 1
Contact:

Re: Android suspend lose GL context

Post by Wolfmanfx » Sun Nov 17, 2013 10:49 pm

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 :)
0 x

aoikonom
Gnoblar
Posts: 23
Joined: Tue Aug 07, 2012 11:05 am

Re: Android suspend lose GL context

Post by aoikonom » Wed Dec 11, 2013 7:18 pm

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
0 x

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 1
Contact:

Re: Android suspend lose GL context

Post by Wolfmanfx » Wed Dec 11, 2013 7:41 pm

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.
0 x

aoikonom
Gnoblar
Posts: 23
Joined: Tue Aug 07, 2012 11:05 am

Re: Android suspend lose GL context

Post by aoikonom » Wed Dec 11, 2013 11:13 pm

Textures for example are kept in memory?
0 x

User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 1
Contact:

Re: Android suspend lose GL context

Post by Wolfmanfx » Mon Mar 03, 2014 10:45 am

Sorry for the late replay - Textures can freed completely to save memory as long there are not referenced somewhere.
0 x

Post Reply