From ffa8a7668bcff7fd95ae5cd4b971f8330efbb3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 5 Jul 2016 11:09:59 +0200 Subject: [core] store viewport and FBO binding --- include/mbgl/gl/gl.hpp | 1 + include/mbgl/gl/gl_values.hpp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'include/mbgl/gl') 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 #include + #include #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; + 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 { -- cgit v1.2.1