summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-07-05 11:09:59 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-09-27 10:42:10 +0200
commitffa8a7668bcff7fd95ae5cd4b971f8330efbb3f0 (patch)
treed4f3ded50238d76c4875a837f642fa7afb8e4470 /include
parent0f5b194617e0250280e0536794625a733a7d447e (diff)
downloadqtlocation-mapboxgl-ffa8a7668bcff7fd95ae5cd4b971f8330efbb3f0.tar.gz
[core] store viewport and FBO binding
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/gl/gl.hpp1
-rw-r--r--include/mbgl/gl/gl_values.hpp25
2 files changed, 26 insertions, 0 deletions
diff --git a/include/mbgl/gl/gl.hpp b/include/mbgl/gl/gl.hpp
index 092166ef96..be6405c593 100644
--- a/include/mbgl/gl/gl.hpp
+++ b/include/mbgl/gl/gl.hpp
@@ -21,6 +21,7 @@
#elif TARGET_OS_MAC
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
+ #include <OpenGL/glext.h>
#else
#error Unsupported Apple platform
#endif
diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp
index e5ad2380d1..fa3b87c435 100644
--- a/include/mbgl/gl/gl_values.hpp
+++ b/include/mbgl/gl/gl_values.hpp
@@ -271,6 +271,31 @@ struct ActiveTexture {
}
};
+struct BindFramebuffer {
+ using Type = GLint;
+ static void Set(const Type& value) {
+ MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, value));
+ }
+ static Type Get() {
+ Type activeFBO;
+ MBGL_CHECK_ERROR(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &activeFBO));
+ return activeFBO;
+ }
+};
+
+struct Viewport {
+ using Type = std::array<GLint, 4>;
+ static void Set(const Type& value) {
+ MBGL_CHECK_ERROR(glViewport(value[0], value[1], value[2], value[3]));
+ }
+ static Type Get() {
+ Type pos;
+ MBGL_CHECK_ERROR(glGetIntegerv(GL_VIEWPORT, pos.data()));
+ return pos;
+ }
+};
+
+
#ifndef GL_ES_VERSION_2_0
struct PixelZoom {