summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/native_map_view.cpp7
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");