summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/vertex_array_extension.hpp
blob: 707a20e6f06f01dc071df5080bd959ad0f4715b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <mbgl/gl/extension.hpp>
#include <mbgl/gl/gl.hpp>

namespace mbgl {
namespace gl {
namespace extension {

class VertexArray {
public:
    template <typename Fn>
    VertexArray(const Fn& loadExtension)
        : bindVertexArray(
              loadExtension({ { "GL_ARB_vertex_array_object", "glBindVertexArray" },
                              { "GL_OES_vertex_array_object", "glBindVertexArrayOES" },
                              { "GL_APPLE_vertex_array_object", "glBindVertexArrayAPPLE" } })),
          deleteVertexArrays(
              loadExtension({ { "GL_ARB_vertex_array_object", "glDeleteVertexArrays" },
                              { "GL_OES_vertex_array_object", "glDeleteVertexArraysOES" },
                              { "GL_APPLE_vertex_array_object", "glDeleteVertexArraysAPPLE" } })),
          genVertexArrays(
              loadExtension({ { "GL_ARB_vertex_array_object", "glGenVertexArrays" },
                              { "GL_OES_vertex_array_object", "glGenVertexArraysOES" },
                              { "GL_APPLE_vertex_array_object", "glGenVertexArraysAPPLE" } })) {
    }

    const ExtensionFunction<void(GLuint array)> bindVertexArray;

    const ExtensionFunction<void(GLsizei n, const GLuint* arrays)> deleteVertexArrays;

    const ExtensionFunction<void(GLsizei n, GLuint* arrays)> genVertexArrays;
};

} // namespace extension
} // namespace gl
} // namespace mbgl