diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-03-22 14:20:35 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-03-28 13:53:19 +0200 |
commit | a84aa453a9124867cb285f012abd97077ab2a019 (patch) | |
tree | 6181d5a39960df96e6dcd2d5c9d905c537b964fe /include/mbgl/map | |
parent | 3f0f4575e77ef289ca209323c0000cf743ab9db2 (diff) | |
download | qtlocation-mapboxgl-a84aa453a9124867cb285f012abd97077ab2a019.tar.gz |
[core] Privatize OpenGL/Context headers
Diffstat (limited to 'include/mbgl/map')
-rw-r--r-- | include/mbgl/map/backend.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <mbgl/map/map_observer.hpp> +#include <mbgl/util/image.hpp> +#include <mbgl/util/size.hpp> #include <memory> #include <mutex> @@ -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<gl::FramebufferID>::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<gl::Context> context; |