On Wed, Mar 6, 2013 at 7:48 AM, a1 <[email protected]> wrote: > >> My minSdk is 7. Preserving GL context is a hint. You call it and pray >> it works. See the official docs at http://developer.android.** >> com/reference/android/opengl/**GLSurfaceView.html#** >> setPreserveEGLContextOnPause(**boolean)<http://developer.android.com/reference/android/opengl/GLSurfaceView.html#setPreserveEGLContextOnPause(boolean)> >> >> It's just works - EGL is only allowed to dispose context on power > management events, OS may terminate application process if user navigate > away but that's it. Anyway if you really want to play nice you can simply > reaload everything when you catch EGL_CONTEXT_LOST. >
Please read the documentation I linked to - it's just a couple of lines, and clear and well-written too. For your reading comfort, here's the key sentence: "Whether the EGL context is actually preserved or not depends upon whether the Android device that the program is running on can support an arbitrary number of EGL contexts or not." You'll also understand from this that the problem is a hardware/driver limitation (the same as known from other platforms) so no amount of hacking at the GLSurfaceView level will fix it. You're right that in EGL spec, the only reason for EGL_CONTEXT_LOST is a power management event but that's just wishful thinking unfortunately. (BTW the whole EGL implementation on Android conforms to the spec only very roughly at best.) I mean if it works for you use it by all means - I'm just saying you cannot *rely* on it working, and personally I'm not comfortable to go down that way (especially since when it does *not* work on an end user machine you'll unlikely to get clear reproducible symptoms - no crash stack etc., just "doesn't work" type of reports). > if you are targeting older version simply back-port (or use one of >>> existing back-ports eg. the one from Replica Island). >>> >> >> That's a solution with its own set of problems. Check some of the >> comments in the RI version. In fact, I highly doubt it would work well >> across the spectrum of today's Android hardware. >> > Why, current GLSurfaceView implementation is based on the one from RI. > Actually, it's the other way around: http://replicaisland.blogspot.cz/2009/10/rendering-with-two-threads.html > GLSurfaceView is just helper class, there is nothing HW specific (see: > https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/opengl/java/android/opengl/GLSurfaceView.java > ) > Well the RI version does have HW-specific hacks, check its source. But the point is moot anyway, see above. While it's true that the older versions of the shipping GLSurfaceView were too eager to drop contexts, even if you fix that you apparently still cannot guarantee when context can or cannot be lost. Which is due to lower-level software or hardware, things out of our control. > I agree it looks like it should be easy to make a Preference*Dialog* >>> instead of PreferenceActivity. And yet, apparently it's not. >>> >> Not _PreferenceDialog_, simply create layout that look's like > PreferenceActivity, do not try to host actual preferences infrastructure > inside dialog since it's not designed to be used that way. > Ah yes, OK, I get it now, you're right. Still, it's a shame the pre-canned Preferences UI is not flexible enough - constructing it manually will take me quite some time I'm afraid as I'm not well-versed in those parts of Android API. -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

