Ok - so I have fixed the rendering problems by taking the source to
GLSurfaceView and changing the onPause() function to be like this:

       public void onPause() {
            synchronized (this) {
                mPaused = true;
---> NEW BIT                requestExitAndWait();
            }
        }

So now it ends the GL thread when onPause() is called.

The documentation for GLSurfaceView does say setRenderer() should only
be "called once and only once in the life-cycle of a GLSurfaceView"
but not obvious how to do that within the Android life-cycle framework
e.g. onCreate(), onStart(), onPause().

I would be welcome for suggestions on how to make a single instance of
GLSurfaceView for the whole life-cycle of my activity including
support for the HOME button which doesn't call onDestroy() but does
call onCreate() repeatedly.

Jake


On Oct 21, 9:12 pm, Zorro666 <j...@evansturner.co.uk> wrote:
> In SDK 1.5
>
> I have a simple GLSurfaceView app which is not working when I use the
> home key to pause it.  If I use the back key then all is fine (onStop
> () and onDestroy() get called). Pressing HOME just calls the onPause()
> function.
>
> The problem appears to be the onPause() call is not terminating the
> glThread.  On successive restarts of the app after pressing the home
> key then I get an extra glThread per run. Only the first run of the
> app leads to proper rendering.
>
> I have implemented the most basic GLSurfaceView app from here
> (changing the clear colour to pink):
>
> http://android-developers.blogspot.com/2009/04/introducing-glsurfacev...
>
> and I get the same problem.  If I press the HOME key then restart the
> app on the second run the graphics rendering is not active i.e. the
> screen stays black instead of pink.
>
> Any suggestions on how to handle the onPause() function properly when
> using a GLSurfaceView.  I am calling the onPause() function in the
> GLSurfaceView member but that isn't enough.  It feels like I need to
> wait for the render thread to finish or process the pause command or
> even force it to exit somehow?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to