summaryrefslogtreecommitdiff
path: root/src/mbgl/map/backend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/map/backend.cpp')
-rw-r--r--src/mbgl/map/backend.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mbgl/map/backend.cpp b/src/mbgl/map/backend.cpp
index a1a2f8f3a8..29f7522e4f 100644
--- a/src/mbgl/map/backend.cpp
+++ b/src/mbgl/map/backend.cpp
@@ -1,16 +1,23 @@
#include <mbgl/map/backend.hpp>
#include <mbgl/map/backend_scope.hpp>
#include <mbgl/gl/context.hpp>
+#include <mbgl/gl/extension.hpp>
+#include <mbgl/gl/debugging.hpp>
#include <cassert>
namespace mbgl {
-Backend::Backend() : context(std::make_unique<gl::Context>()) {
-}
+Backend::Backend() = default;
gl::Context& Backend::getContext() {
assert(BackendScope::exists());
+ std::call_once(initialized, [this] {
+ context = std::make_unique<gl::Context>();
+ gl::debugging::enable();
+ gl::initializeExtensions(
+ std::bind(&Backend::initializeExtension, this, std::placeholders::_1));
+ });
return *context;
}