Handle "OpenGL context lost" event on Android

- added a new runtime function `halide_opengl_context_lost` that resets all context-specific state held by Halide
- update HelloAndroidGL example to handle context lost events correctly
- extend example app to optionally render directly to the current framebuffer instead of going through a texture
- bring README file up-to-date
The value returned by this function instructs the Halide runtime to not
bind its own render target as the output buffer, but instead use whatever
is currently bound by the application.

Halide can't control what this is- in most cases it would be an off screen
buffer or a resource bound to something like a video frame.

How about:

halide_opengl_do_not_bind_output()

Abe



On Wed, Sep 24, 2014 at 8:29 AM, Daniel Heck <notifications@github.com>
wrote:

> In src/runtime/opengl.cpp:
>
> > @@ -903,11 +929,7 @@ WEAK int halide_opengl_dev_sync(void *user_context) {
> >      return 0;
> >  }
> >
> > -// This function is called to populate the buffer_t.dev field with a constant
> > -// indicating that the OpenGL object corresponding to the buffer_t is bound by
> > -// the app and not by the Halide runtime. For example, the buffer_t may be
> > -// backed by an FBO already bound by the application.
> > -WEAK uint64_t halide_opengl_output_client_bound() {
> > +extern "C" WEAK uint64_t halide_opengl_output_client_bound() {
>
> I agree that the name isn't optimal... what about
> halide_opengl_render_to_screen? @abestephensg
> <https://github.com/abestephensg> : any opinions?
>
> Good point regarding namespace/extern "C", I moved the two functions to
> extern "C" block at the bottom of the file.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/halide/Halide/pull/479/files#r17978360>.
>