diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-02-27 18:33:16 +0100 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-23 14:50:11 -0700 |
commit | 234384ece9c70f2a803ed2b1d1eb55b248ec43d1 (patch) | |
tree | a69fa3e64179667d79546f4f3d1b33f041e4ea22 /include/mbgl/map | |
parent | 8e5214144ec4f3a4fb40b7a7e4d8f09fd10dbb78 (diff) | |
download | qtlocation-mapboxgl-234384ece9c70f2a803ed2b1d1eb55b248ec43d1.tar.gz |
[core] Move OpenGL extension initialization to Backend
Diffstat (limited to 'include/mbgl/map')
-rw-r--r-- | include/mbgl/map/backend.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/mbgl/map/backend.hpp b/include/mbgl/map/backend.hpp index cd756abe43..876c19261b 100644 --- a/include/mbgl/map/backend.hpp +++ b/include/mbgl/map/backend.hpp @@ -3,11 +3,13 @@ #include <mbgl/map/map_observer.hpp> #include <memory> +#include <mutex> namespace mbgl { namespace gl { class Context; +using ProcAddress = void (*)(); } // namespace gl class BackendScope; @@ -25,6 +27,11 @@ public: virtual void invalidate() = 0; protected: + // Called with the name of an OpenGL extension that should be loaded. Backend implementations + // must call the API-specific version that obtains the function pointer for this function, + // or a null pointer if unsupported/unavailable. + virtual gl::ProcAddress initializeExtension(const char*) = 0; + // Called when the backend's GL context needs to be made active or inactive. These are called, // as a matched pair, in four situations: // @@ -38,8 +45,12 @@ protected: virtual void activate() = 0; virtual void deactivate() = 0; +protected: std::unique_ptr<gl::Context> context; +private: + std::once_flag initialized; + friend class BackendScope; }; |