I think I may be able to answer part of this question, as a good
nights sleep and a necessary walk with our family dog in the morning
chill seemed to have set something straight in my head.

The outer while loop is necessary because, the secondary thread the
GLThread is taking responsibility to update the drawing surface. This
means this thread has to be alive for the life of the activity showing
this view.

However it doesn't have to draw every time it goes through the loop,
unless you need animation. when animation is not needed, you need to
find a way to put the thread to a "wait' and some event such as
changing sizes etc or pause and resume to wake up this sleeping thread
so that it can redraw. so you will need to change the "needToWait()"
function to add this one time behavior.

The current implementation assumes animation and hence works where it
continues to redrawn even though nothing has changed on the surface.

Hope someone can confirm this....

Thanks
Satya

On Tue, Jan 13, 2009 at 10:38 PM, Satya Komatineni
<satya.komatin...@gmail.com> wrote:
> I see that In GLSurfaceView sample GLThread is doing the OpenGL
> drawing. I see a code snippet in its run method
>
> that starts with
>
> while (!mDone)
> {
> ....
> ....
>     while (needToWait()){{}
> .....
> }
>
> I understand that the surface may not be ready to be drawn and so I
> get the second while loop. But the outside main loop, is that needed
> only for the "animation?"
>
> I have tried taking it out with out much success.
>
> Can someone confirm if this is there only for animation or needed for
> someother reason?
>
> If I want to do one time drawing of OpenGL, what conidtions have to be
> met to create the GL context?
>
> Your help is much appreciated
> Thanks
> Satya
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to