summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Zugaldia <antonio@mapbox.com>2016-11-15 15:10:59 +0100
committerAntonio Zugaldia <antonio@mapbox.com>2016-11-15 15:10:59 +0100
commitfa4a5ea81594be64be07970b450325f8e4f39b08 (patch)
tree45bb44708475164995cb850ca1b16292cfcdb3fa
parentee805732bdec99c37883326b3c67391a0f4cb161 (diff)
parent4bc8d53b7c1ae5cf98fa9d480c19a2f13fd789eb (diff)
downloadqtlocation-mapboxgl-fa4a5ea81594be64be07970b450325f8e4f39b08.tar.gz
Merge branch 'release-android-v4.2.0' of https://github.com/mapbox/mapbox-gl-native into release-android-v4.2.0
-rw-r--r--package.json2
-rwxr-xr-xplatform/android/src/native_map_view.cpp51
-rwxr-xr-xplatform/android/src/native_map_view.hpp2
3 files changed, 29 insertions, 26 deletions
diff --git a/package.json b/package.json
index 7abe377a47..cf6746fd8b 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"ejs": "^2.4.1",
"express": "^4.11.1",
"lodash": "^4.16.4",
- "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#98a56d538b11fb331aa67a6d632d6ecd6821b007",
+ "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#170079c80891fe960ec6adeac2983d9d30ca4cbf",
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#7f62a4fc9f21e619824d68abbc4b03cbc1685572",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#af9ee275f19e81f839a2733e6906c3fac272620e",
"mkdirp": "^0.5.1",
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index c1283693d0..be15877e70 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -253,13 +253,6 @@ mbgl::Map &NativeMapView::getMap() { return *map; }
mbgl::DefaultFileSource &NativeMapView::getFileSource() { return *fileSource; }
-bool NativeMapView::inEmulator() {
- // Detect if we are in emulator
- char prop[PROP_VALUE_MAX];
- __system_property_get("ro.kernel.qemu", prop);
- return strtol(prop, nullptr, 0) == 1;
-}
-
void NativeMapView::initializeDisplay() {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::initializeDisplay");
@@ -289,22 +282,39 @@ void NativeMapView::initializeDisplay() {
log_egl_string(display, EGL_CLIENT_APIS, "Client APIs");
log_egl_string(display, EGL_EXTENSIONS, "Client Extensions");
- // Detect if we are in emulator
- if (inEmulator()) {
+ // Detect if we are in emulator.
+ const bool inEmulator = []() {
+ char prop[PROP_VALUE_MAX];
+ __system_property_get("ro.kernel.qemu", prop);
+ return strtol(prop, nullptr, 0) == 1;
+ }();
+
+ if (inEmulator) {
+ // XXX https://code.google.com/p/android/issues/detail?id=78977
mbgl::Log::Warning(mbgl::Event::Android, "In emulator! Enabling hacks :-(");
}
+ if (!eglBindAPI(EGL_OPENGL_ES_API)) {
+ mbgl::Log::Error(mbgl::Event::OpenGL, "eglBindAPI(EGL_OPENGL_ES_API) returned error %d", eglGetError());
+ throw std::runtime_error("eglBindAPI() failed");
+ }
+
// Get all configs at least RGB 565 with 16 depth and 8 stencil
EGLint configAttribs[] = {
- EGL_CONFIG_CAVEAT, EGL_NONE, EGL_RENDERABLE_TYPE,
- EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
- EGL_BUFFER_SIZE, 16, EGL_RED_SIZE,
- 5, EGL_GREEN_SIZE, 6,
- EGL_BLUE_SIZE, 5, EGL_DEPTH_SIZE,
- 16, EGL_STENCIL_SIZE, 8,
- (inEmulator() ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT, // Ugly hack
- (inEmulator() ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER, // Ugly hack
- EGL_NONE};
+ EGL_CONFIG_CAVEAT, EGL_NONE,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_BUFFER_SIZE, 16,
+ EGL_RED_SIZE, 5,
+ EGL_GREEN_SIZE, 6,
+ EGL_BLUE_SIZE, 5,
+ EGL_DEPTH_SIZE, 16,
+ EGL_STENCIL_SIZE, 8,
+ (inEmulator ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT,
+ (inEmulator ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER,
+ EGL_NONE
+ };
+
EGLint numConfigs;
if (!eglChooseConfig(display, configAttribs, nullptr, 0, &numConfigs)) {
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig(NULL) returned error %d",
@@ -442,11 +452,6 @@ void NativeMapView::createSurface(ANativeWindow *window_) {
log_gl_string(GL_VENDOR, "Vendor");
log_gl_string(GL_RENDERER, "Renderer");
log_gl_string(GL_VERSION, "Version");
- if (!inEmulator()) {
- log_gl_string(GL_SHADING_LANGUAGE_VERSION,
- "SL Version"); // In the emulator this returns NULL with error code 0?
- // https://code.google.com/p/android/issues/detail?id=78977
- }
log_gl_string(GL_EXTENSIONS, "Extensions");
mbgl::gl::InitializeExtensions([] (const char * name) {
diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp
index 18f9ebc144..14b9842c72 100755
--- a/platform/android/src/native_map_view.hpp
+++ b/platform/android/src/native_map_view.hpp
@@ -57,8 +57,6 @@ public:
private:
EGLConfig chooseConfig(const EGLConfig configs[], EGLint numConfigs);
- bool inEmulator();
-
private:
JavaVM *vm = nullptr;
JNIEnv *env = nullptr;