diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-08-03 15:59:03 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-08-04 14:08:20 +0200 |
commit | 66f0473bcf585724a0311416466b30694d7754d0 (patch) | |
tree | 72c87b2c89b8abeb5835801a409aefbfa7170b67 /include | |
parent | 78ec33320ff5837f23e85e336716692f63fd0254 (diff) | |
download | qtlocation-mapboxgl-66f0473bcf585724a0311416466b30694d7754d0.tar.gz |
add MBGL_USE_GLES2 define
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/platform/default/glfw_view.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/platform/gl.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/gl_helper.hpp | 21 |
3 files changed, 14 insertions, 11 deletions
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 <mbgl/mbgl.hpp> -#ifdef NVIDIA +#ifdef MBGL_USE_GLES2 #define GLFW_INCLUDE_ES2 #endif #include <GLFW/glfw3.h> 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 <GLES2/gl2.h> #include <GLES2/gl2ext.h> 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<double, 4> getClearColor() { - std::array<double, 4> color; - MBGL_CHECK_ERROR(glGetDoublev(GL_COLOR_CLEAR_VALUE, color.data())); +inline std::array<float, 4> getClearColor() { + std::array<float, 4> color; + MBGL_CHECK_ERROR(glGetFloatv(GL_COLOR_CLEAR_VALUE, color.data())); return color; } -inline void setClearColor(const std::array<double, 4>& color) { +inline void setClearColor(const std::array<float, 4>& color) { MBGL_CHECK_ERROR(glClearColor(color[0], color[1], color[2], color[3])); } inline std::array<GLenum, 2> 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<GLenum>(func[0]), static_cast<GLenum>(func[1]) }}; } @@ -47,7 +47,7 @@ inline void setBlendFunc(const std::array<GLenum, 2>& func) { MBGL_CHECK_ERROR(glBlendFunc(func[0], func[1])); } - +#ifndef GL_ES_VERSION_2_0 inline std::array<double, 2> getPixelZoom() { std::array<double, 2> zoom; glGetDoublev(GL_ZOOM_X, &zoom[0]); @@ -69,17 +69,20 @@ inline std::array<double, 4> getRasterPos() { inline void setRasterPos(const std::array<double, 4>& pos) { MBGL_CHECK_ERROR(glRasterPos4d(pos[0], pos[1], pos[2], pos[3])); } - +#endif } // end anonymous namespace namespace mbgl { namespace gl { using PreserveBlend = Preserve<bool, getBlend, setBlend>; -using PreserveClearColor = Preserve<std::array<double, 4>, getClearColor, setClearColor>; +using PreserveClearColor = Preserve<std::array<float, 4>, getClearColor, setClearColor>; using PreserveBlendFunc = Preserve<std::array<GLenum, 2>, getBlendFunc, setBlendFunc>; + +#ifndef GL_ES_VERSION_2_0 using PreservePixelZoom = Preserve<std::array<double, 2>, getPixelZoom, setPixelZoom>; using PreserveRasterPos = Preserve<std::array<double, 4>, getRasterPos, setRasterPos>; +#endif } } |