From a84aa453a9124867cb285f012abd97077ab2a019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 22 Mar 2017 14:20:35 +0100 Subject: [core] Privatize OpenGL/Context headers --- include/mbgl/map/backend.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include/mbgl/map') diff --git a/include/mbgl/map/backend.hpp b/include/mbgl/map/backend.hpp index 876c19261b..884c4b5256 100644 --- a/include/mbgl/map/backend.hpp +++ b/include/mbgl/map/backend.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include #include @@ -10,6 +12,7 @@ namespace mbgl { namespace gl { class Context; using ProcAddress = void (*)(); +using FramebufferID = uint32_t; } // namespace gl class BackendScope; @@ -22,6 +25,9 @@ public: // Returns the backend's context which manages OpenGL state. gl::Context& getContext(); + // Called prior to rendering to update the internally assumed OpenGL state. + virtual void updateAssumedState() = 0; + // Called when the map needs to be rendered; the backend should call Map::render() at some point // in the near future. (Not called for Map::renderStill() mode.) virtual void invalidate() = 0; @@ -45,6 +51,26 @@ protected: virtual void activate() = 0; virtual void deactivate() = 0; + // Reads the color pixel data from the currently bound framebuffer. + PremultipliedImage readFramebuffer(const Size&) const; + + // A constant to signal that a framebuffer is bound, but with an unknown ID. + static constexpr const gl::FramebufferID ImplicitFramebufferBinding = + std::numeric_limits::max(); + + // Tells the renderer that OpenGL state has already been set by the windowing toolkit. + // It sets the internal assumed state to the supplied values. + void assumeFramebufferBinding(gl::FramebufferID fbo); + void assumeViewportSize(const Size&); + + // Returns true when assumed framebuffer binding hasn't changed from the implicit binding. + bool implicitFramebufferBound(); + + // Triggers an OpenGL state update if the internal assumed state doesn't match the + // supplied values. + void setFramebufferBinding(gl::FramebufferID fbo); + void setViewportSize(const Size&); + protected: std::unique_ptr context; -- cgit v1.2.1