1 #pragma once
2 
3 #include <mbgl/gl/extension.hpp>
4 #include <mbgl/gl/gl.hpp>
5 
6 namespace mbgl {
7 namespace gl {
8 namespace extension {
9 
10 class VertexArray {
11 public:
12     template <typename Fn>
VertexArray(const Fn & loadExtension)13     VertexArray(const Fn& loadExtension)
14         : bindVertexArray(
15               loadExtension({ { "GL_ARB_vertex_array_object", "glBindVertexArray" },
16                               { "GL_OES_vertex_array_object", "glBindVertexArrayOES" },
17                               { "GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE" } })),
18           deleteVertexArrays(
19               loadExtension({ { "GL_ARB_vertex_array_object", "glDeleteVertexArrays" },
20                               { "GL_OES_vertex_array_object", "glDeleteVertexArraysOES" },
21                               { "GL_APPLE_vertex_array_object", "glDeleteVertexArraysAPPLE" } })),
22           genVertexArrays(
23               loadExtension({ { "GL_ARB_vertex_array_object", "glGenVertexArrays" },
24                               { "GL_OES_vertex_array_object", "glGenVertexArraysOES" },
25                               { "GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE" } })) {
26     }
27 
28     const ExtensionFunction<void(GLuint array)> bindVertexArray;
29 
30     const ExtensionFunction<void(GLsizei n, const GLuint* arrays)> deleteVertexArrays;
31 
32     const ExtensionFunction<void(GLsizei n, GLuint* arrays)> genVertexArrays;
33 };
34 
35 } // namespace extension
36 } // namespace gl
37 } // namespace mbgl
38