From 234384ece9c70f2a803ed2b1d1eb55b248ec43d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 27 Feb 2017 18:33:16 +0100 Subject: [core] Move OpenGL extension initialization to Backend --- include/mbgl/map/backend.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/mbgl/map') 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 #include +#include 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 context; +private: + std::once_flag initialized; + friend class BackendScope; }; -- cgit v1.2.1