[linux] Ensure EGL uses OpenGL ES 2.0 client API

This commit is contained in:
Bruno de Oliveira Abinader
2016-11-11 16:37:44 +02:00
parent 0ef52d7f7c
commit ad38ff230b
3 changed files with 27 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/util/string.hpp>
#include <EGL/egl.h>
@@ -25,6 +26,11 @@ HeadlessDisplay::Impl::Impl() {
throw std::runtime_error("eglInitialize() failed.\n");
}
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");
}
// This shouldn't matter as we're rendering to a framebuffer.
const EGLint attribs[] = { EGL_NONE };
if (!eglChooseConfig(display, attribs, &config, 1, &numConfigs) || numConfigs != 1) {