From: Diederick C. N. <dc...@gm...> - 2013-04-04 10:43:18
|
Hi Sylvain, I have now pushed the large changes I talked about before (r1577). Actually, for Andriod, it doesn't have much impact. I have just: - cleaned up the usage of the LastHeight and LastWidth vars as there is another function to check now if they changed - removed the window->State.NeedToInitContext in the APP_CMD_TERM_WINDOW handler. As i understand it, there is already the forced call to the initcontext cb on line 471 in fg_main_andriod that takes care of this. I have added a note there for what i was thinking, please do delete or edit. - oh, in other changes: we now have a GLES compatible version of the teapot and such, so i have removed the ifdef guards around those functions. Should work in GLES1 and 2, just like the other shapes. All in all, hope testing will take very little time for you and i hope i didn't mess anything up. Thanks a lot! Best, Dee On Tue, Mar 19, 2013 at 9:39 AM, Diederick C. Niehorster <dc...@gm...> wrote: > Hi, > > Hmm, good point. > I'll have another look and insert where it might make sense, with a > big note to you. > > Thanks! > Dee > > On Tue, Mar 19, 2013 at 7:24 AM, Sylvain <be...@be...> wrote: >> Hi, >> >> On Sun, Mar 17, 2013 at 10:41:58PM +0800, Diederick C. Niehorster wrote: >>> Thanks for the feedback, I'll go for a single callback named >>> glutAppStatus (or something better in mind?) that returns either >>> GLUT_PAUSED or GLUT_RESUMED. >>> >>> On Sun, Mar 17, 2013 at 8:27 PM, Sylvain <be...@be...> wrote: >>> > >>> > Yes, let me know and I'll test again with the Wikibooks code samples. >>> >>> Thanks! I'll let you know once i post it. I'd like to incorporate the >>> changes were discussing here at once as well, get that over with in >>> one feel swoop. >>> >>> > The functions are mapped from the diagram at: >>> > http://developer.android.com/reference/android/app/Activity.html >>> > >>> > I simplified the states, so I'd advise to be careful with the naming. >>> > As far as I can remember, the pause/resume callback is the place to >>> > save the app state already (feel free to double-check). >>> >>> Yup, you're right, that would do the trick I think. >>> >>> > In the API doc I'd written: >>> > http://freeglut.sourceforge.net/docs/api.php#Android >>> > glutInitContextFunc ← void : called when the context is initialized or re-initialized (e.g. after a pause) >>> > glutPauseFunc ← void : called when the application goes on a pause (or a stop) >>> > glutResumeFunc ← void : called when the application comes back from a pause ([called] after glutInitContextFunc) >>> >>> Ah I see, true. I'm struggling slightly with the placement of >>> InitContext CB calls. As I have shuffled around things, it is now no >>> longer in the fhgRedrawWindow function (which gets called for every >>> redraw, so i kept it completely lean). That new worklist i made has an >>> INIT_WORK work-type, which gets executed for all open windows once the >>> mainloop is entered, or every time a new window is opened (if already >>> in mainloop). For windows/X11 I just put the InitContext call there >>> (after calls to WindowStatus, Reshape and Position CBs). >>> >>> For Android i thought it would be okay to simply do init again when >>> the app is resumed, so i queued up init work both when >>> APP_CMD_INIT_WINDOW and APP_CMD_TERM_WINDOW is received. I now realize >>> the second is wrong as the mainloop keeps running in the background >>> (and my work thus executed immediately), right? Also, with my setup, >>> even if it worked, the Resume CB would be called before the >>> InitContext CB upon resume, violating your API. >>> >>> If I am reading the code correctly, it'd be better to put it in the >>> pause/resume handling code in fgPlatformProcessSingleEvent. Should it >>> be only in the "if (app->destroyRequested != 1)" block there (I am >>> wondering as the Resume CB call is outside that block)? >>> >>> Hope i'm not terribly confusing here. Also sorry that i am coding in >>> the dark here (no device or X11 desktop to test on), so i hope i am >>> not doing something terribly stupid. >>> >>> Best and thanks a lot for your time, >>> Dee >> >> The (re)initialisation of the Android app is full of tricks and I >> don't remember well enough right now. I need to take some time and do >> some tests. >> >> -- >> Sylvain |