blob: ab317514f57b660da8a9b995a42ec1343d052b6d (
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
39
40
41
42
43
44
45
46
47
48
|
#ifndef GLVERTEXARRAYS_H
#define GLVERTEXARRAYS_H
#include <GL/glew.h>
#include <array>
#include <cstddef>
#include <special_members.hpp>
class glVertexArraysBase {
protected:
static void gen(GLsizei, GLuint *);
static void del(GLsizei, const GLuint *);
};
template<size_t N> class glVertexArrays : glVertexArraysBase {
public:
glVertexArrays()
{
gen(N, ids.data());
}
~glVertexArrays()
{
del(N, ids.data());
}
NO_COPY(glVertexArrays);
NO_MOVE(glVertexArrays);
// NOLINTNEXTLINE(hicpp-explicit-conversions)
operator GLuint() const
{
static_assert(N == 1, "Implicit cast only if N == 1");
return ids.front();
}
auto
operator[](size_t n) const
{
return ids[n];
}
private:
std::array<GLuint, N> ids {};
};
using glVertexArray = glVertexArrays<1>;
#endif
|