diff options
author | Leith Bade <leith@mapbox.com> | 2015-10-27 12:34:32 +1100 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2015-10-27 15:27:08 +1100 |
commit | fd33dfcd7321346631cd9237b5ae2993c29f9ca5 (patch) | |
tree | eb86bd45b267b0635bbf7d839c5ffe64ddd7d24b /platform/android | |
parent | d48c640b5c29699e4ffb60a6268e97784164eebd (diff) | |
download | qtlocation-mapboxgl-fd33dfcd7321346631cd9237b5ae2993c29f9ca5.tar.gz |
[android] Restore old GL context after createSurface
Fixes #2807
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/native_map_view.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/android/native_map_view.cpp b/platform/android/native_map_view.cpp index 9c4d4b1d10..0a69f2d2da 100644 --- a/platform/android/native_map_view.cpp +++ b/platform/android/native_map_view.cpp @@ -398,6 +398,11 @@ void NativeMapView::createSurface(ANativeWindow *window_) { if (!firstTime) { firstTime = true; + EGLDisplay oldDisplay = eglGetCurrentDisplay(); + EGLSurface oldReadSurface = eglGetCurrentSurface(EGL_READ); + EGLSurface oldDrawSurface = eglGetCurrentSurface(EGL_DRAW); + EGLContext oldContext = eglGetCurrentContext(); + if (!eglMakeCurrent(display, surface, surface, context)) { mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent() returned error %d", eglGetError()); @@ -418,7 +423,7 @@ void NativeMapView::createSurface(ANativeWindow *window_) { return reinterpret_cast<mbgl::gl::glProc>(eglGetProcAddress(name)); }); - if (!eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) { + if (!eglMakeCurrent(oldDisplay, oldDrawSurface, oldReadSurface, oldContext)) { mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent(EGL_NO_CONTEXT) returned error %d", eglGetError()); throw new std::runtime_error("eglMakeCurrent() failed"); |