summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/gl.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-28 17:21:20 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-29 13:19:27 -0700
commit2ec2860ce5de2bde751086db13de1c09e643c28c (patch)
treed9539718dde07e3ddeaf2b502032828157a25e27 /src/mbgl/gl/gl.cpp
parentcc78b74098e02311cc646fe5b82c13641ff705fa (diff)
downloadqtlocation-mapboxgl-2ec2860ce5de2bde751086db13de1c09e643c28c.tar.gz
[core] move OpenGL extension loading to their own headers
Diffstat (limited to 'src/mbgl/gl/gl.cpp')
-rw-r--r--src/mbgl/gl/gl.cpp54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/mbgl/gl/gl.cpp b/src/mbgl/gl/gl.cpp
index 2040ff0573..5cef254160 100644
--- a/src/mbgl/gl/gl.cpp
+++ b/src/mbgl/gl/gl.cpp
@@ -1,63 +1,9 @@
#include <mbgl/gl/gl.hpp>
#include <mbgl/util/string.hpp>
-#include <mbgl/platform/log.hpp>
-
-#include <cassert>
-#include <iostream>
-#include <unordered_map>
-#include <mutex>
namespace mbgl {
namespace gl {
-ExtensionFunction<void (GLuint array)>
- BindVertexArray({
- {"GL_ARB_vertex_array_object", "glBindVertexArray"},
- {"GL_OES_vertex_array_object", "glBindVertexArrayOES"},
- {"GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE"}
- });
-
-ExtensionFunction<void (GLsizei n, const GLuint* arrays)>
- DeleteVertexArrays({
- {"GL_ARB_vertex_array_object", "glDeleteVertexArrays"},
- {"GL_OES_vertex_array_object", "glDeleteVertexArraysOES"},
- {"GL_APPLE_vertex_array_object", "glDeleteVertexArraysAPPLE"}
- });
-
-ExtensionFunction<void (GLsizei n, GLuint* arrays)>
- GenVertexArrays({
- {"GL_ARB_vertex_array_object", "glGenVertexArrays"},
- {"GL_OES_vertex_array_object", "glGenVertexArraysOES"},
- {"GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE"}
- });
-
-std::vector<ExtensionFunctionBase*>& ExtensionFunctionBase::functions() {
- static std::vector<ExtensionFunctionBase*> functions;
- return functions;
-}
-
-static std::once_flag initializeExtensionsOnce;
-
-void InitializeExtensions(glProc (*getProcAddress)(const char *)) {
- std::call_once(initializeExtensionsOnce, [getProcAddress] {
- const char * extensionsPtr = reinterpret_cast<const char *>(
- MBGL_CHECK_ERROR(glGetString(GL_EXTENSIONS)));
-
- if (!extensionsPtr)
- return;
-
- const std::string extensions = extensionsPtr;
- for (auto fn : ExtensionFunctionBase::functions()) {
- for (auto probe : fn->probes) {
- if (extensions.find(probe.first) != std::string::npos) {
- fn->ptr = getProcAddress(probe.second);
- break;
- }
- }
- }
- });
-}
-
namespace {
constexpr const char* stringFromError(GLenum err) {