[core] Refactor OpenGL extension loading mechanism

Previously, we initialized global variables that held pointers to the extension functions. While this seemed to work, the spec doesn't guarantee that the function pointers are identical for different OpenGL contexts. Therefore, we are now making them a member variable of the Context object.
This commit is contained in:
Konstantin Käfer
2017-02-27 18:33:16 +01:00
committed by John Firebaugh
parent 234384ece9
commit e67abfbe67
23 changed files with 453 additions and 379 deletions

View File

@@ -1,22 +0,0 @@
#include <mbgl/gl/vertex_array.hpp>
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" } });
} // namespace gl
} // namespace mbgl