From a47ab85283bea14bcc464526701bafaf1b8312e2 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 14 Apr 2016 12:11:02 -0700 Subject: [PATCH] [core] Don't put static objects in a header file (#4707) This causes duplicate objects -- one for every file that includes that header. --- include/mbgl/gl/gl.hpp | 29 ++++++----------------------- src/mbgl/gl/gl.cpp | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/include/mbgl/gl/gl.hpp b/include/mbgl/gl/gl.hpp index 2d9b3f7a7..5ef76cf1d 100644 --- a/include/mbgl/gl/gl.hpp +++ b/include/mbgl/gl/gl.hpp @@ -110,31 +110,14 @@ public: using glProc = void (*)(); void InitializeExtensions(glProc (*getProcAddress)(const char *)); -static gl::ExtensionFunction< - void (GLuint array)> - BindVertexArray({ - {"GL_ARB_vertex_array_object", "glBindVertexArray"}, - {"GL_OES_vertex_array_object", "glBindVertexArrayOES"}, - {"GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE"} - }); +extern ExtensionFunction + BindVertexArray; -static gl::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"} - }); +extern ExtensionFunction + DeleteVertexArrays; -static gl::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"} - }); +extern ExtensionFunction + GenVertexArrays; } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/gl.cpp b/src/mbgl/gl/gl.cpp index c57717aa8..48f00ec17 100644 --- a/src/mbgl/gl/gl.cpp +++ b/src/mbgl/gl/gl.cpp @@ -10,6 +10,27 @@ namespace mbgl { namespace gl { +ExtensionFunction + BindVertexArray({ + {"GL_ARB_vertex_array_object", "glBindVertexArray"}, + {"GL_OES_vertex_array_object", "glBindVertexArrayOES"}, + {"GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE"} + }); + +ExtensionFunction + DeleteVertexArrays({ + {"GL_ARB_vertex_array_object", "glDeleteVertexArrays"}, + {"GL_OES_vertex_array_object", "glDeleteVertexArraysOES"}, + {"GL_APPLE_vertex_array_object", "glDeleteVertexArraysAPPLE"} + }); + +ExtensionFunction + GenVertexArrays({ + {"GL_ARB_vertex_array_object", "glGenVertexArrays"}, + {"GL_OES_vertex_array_object", "glGenVertexArraysOES"}, + {"GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE"} + }); + std::vector& ExtensionFunctionBase::functions() { static std::vector functions; return functions;