X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_window_android.c;h=af2d6912a6d088a311f85c19f77e296b05a88209;hb=af47c3f93c7834b4006c49ec9df6a6ffdd3025de;hp=370f1dc91416c66f554c4243047a172c2abe3dde;hpb=99d53f15a4216240088132f6af9cb194b519b1cc;p=freeglut diff --git a/src/android/fg_window_android.c b/src/android/fg_window_android.c index 370f1dc..af2d691 100644 --- a/src/android/fg_window_android.c +++ b/src/android/fg_window_android.c @@ -64,6 +64,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, /* fgPlatformProcessSingleEvent(); */ } window->Window.Handle = fgDisplay.pDisplay.single_native_window; + window->State.WorkMask |= GLUT_INIT_WORK; /* Create context */ fghChooseConfig(&window->Window.pContext.egl.Config); @@ -82,6 +83,14 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, fghPlatformOpenWindowEGL(window); + /* Bind context to the current thread if it's lost */ + if (eglGetCurrentContext() == EGL_NO_CONTEXT && + eglMakeCurrent(fgDisplay.pDisplay.egl.Display, + window->Window.pContext.egl.Surface, + window->Window.pContext.egl.Surface, + window->Window.Context) == EGL_FALSE) + fgError("eglMakeCurrent: err=%x\n", eglGetError()); + window->State.Visible = GL_TRUE; }