From 66f0473bcf585724a0311416466b30694d7754d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 3 Aug 2015 15:59:03 +0200 Subject: add MBGL_USE_GLES2 define --- include/mbgl/platform/default/glfw_view.hpp | 2 +- include/mbgl/platform/gl.hpp | 2 +- include/mbgl/util/gl_helper.hpp | 21 ++++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/mbgl/platform/default/glfw_view.hpp b/include/mbgl/platform/default/glfw_view.hpp index f65565c030..1bc210b29e 100644 --- a/include/mbgl/platform/default/glfw_view.hpp +++ b/include/mbgl/platform/default/glfw_view.hpp @@ -3,7 +3,7 @@ #include -#ifdef NVIDIA +#ifdef MBGL_USE_GLES2 #define GLFW_INCLUDE_ES2 #endif #include diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp index 73f0801fa5..6bcb85fee7 100644 --- a/include/mbgl/platform/gl.hpp +++ b/include/mbgl/platform/gl.hpp @@ -19,7 +19,7 @@ #else #error Unsupported Apple platform #endif -#elif __ANDROID__ +#elif __ANDROID__ || MBGL_USE_GLES2 #define GL_GLEXT_PROTOTYPES #include #include diff --git a/include/mbgl/util/gl_helper.hpp b/include/mbgl/util/gl_helper.hpp index cf007e8a62..288fc2c681 100644 --- a/include/mbgl/util/gl_helper.hpp +++ b/include/mbgl/util/gl_helper.hpp @@ -25,21 +25,21 @@ inline void setBlend(const bool& enabled) { enabled ? MBGL_CHECK_ERROR(glEnable(GL_BLEND)) : MBGL_CHECK_ERROR(glDisable(GL_BLEND)); } -inline std::array getClearColor() { - std::array color; - MBGL_CHECK_ERROR(glGetDoublev(GL_COLOR_CLEAR_VALUE, color.data())); +inline std::array getClearColor() { + std::array color; + MBGL_CHECK_ERROR(glGetFloatv(GL_COLOR_CLEAR_VALUE, color.data())); return color; } -inline void setClearColor(const std::array& color) { +inline void setClearColor(const std::array& color) { MBGL_CHECK_ERROR(glClearColor(color[0], color[1], color[2], color[3])); } inline std::array getBlendFunc() { GLint func[2]; - glGetIntegerv(GL_BLEND_SRC, &func[0]); - glGetIntegerv(GL_BLEND_DST, &func[1]); + glGetIntegerv(GL_BLEND_SRC_ALPHA, &func[0]); + glGetIntegerv(GL_BLEND_DST_ALPHA, &func[1]); return {{ static_cast(func[0]), static_cast(func[1]) }}; } @@ -47,7 +47,7 @@ inline void setBlendFunc(const std::array& func) { MBGL_CHECK_ERROR(glBlendFunc(func[0], func[1])); } - +#ifndef GL_ES_VERSION_2_0 inline std::array getPixelZoom() { std::array zoom; glGetDoublev(GL_ZOOM_X, &zoom[0]); @@ -69,17 +69,20 @@ inline std::array getRasterPos() { inline void setRasterPos(const std::array& pos) { MBGL_CHECK_ERROR(glRasterPos4d(pos[0], pos[1], pos[2], pos[3])); } - +#endif } // end anonymous namespace namespace mbgl { namespace gl { using PreserveBlend = Preserve; -using PreserveClearColor = Preserve, getClearColor, setClearColor>; +using PreserveClearColor = Preserve, getClearColor, setClearColor>; using PreserveBlendFunc = Preserve, getBlendFunc, setBlendFunc>; + +#ifndef GL_ES_VERSION_2_0 using PreservePixelZoom = Preserve, getPixelZoom, setPixelZoom>; using PreserveRasterPos = Preserve, getRasterPos, setRasterPos>; +#endif } } -- cgit v1.2.1