summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/vertex_array_extension.hpp
blob: 967d99af3294d0db5b51219bd92b67e0a2d046df (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
38
#pragma once

#include <mbgl/gl/extension.hpp>
#include <mbgl/gl/defines.hpp>
#include <mbgl/platform/gl_functions.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(platform::GLuint array)> bindVertexArray;

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

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

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