-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEBO.tpp
More file actions
87 lines (69 loc) · 1.88 KB
/
EBO.tpp
File metadata and controls
87 lines (69 loc) · 1.88 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef EBO_TEMPLATE
#define EBO_TEMPLATE
#ifdef GL_API_GLAD_OPENGL_3
template <typename type>
EBO<type>::EBO(type* indices, GLsizeiptr size, GLenum howUse) {
Init(indices, size, howUse);
}
template <typename type>
EBO<type>::~EBO() {
Delete();
}
template <typename type>
void EBO<type>::Init(type* indices, GLsizeiptr size, GLenum howUse) {
Init(&ID, indices, size, howUse);
}
template <typename type>
void EBO<type>::Init(GLuint* ID, type* indices, GLsizeiptr size, GLenum howUse) {
glGenBuffers(1, ID);
Bind(*ID);
Data(indices, size, howUse);
}
template <typename type>
void EBO<type>::Data(type* indices, GLsizeiptr size, GLenum howUse) {
glBufferData(bufferType, size, indices, howUse);
}
template <typename type>
void EBO<type>::SubData(type* indices, GLintptr offset, GLsizeiptr size) {
glBufferSubData(bufferType, offset, size, indices);
}
template <typename type>
type* EBO<type>::GetSubData(GLintptr offset, GLsizeiptr size) {
void* indices = new char[size];
glGetBufferSubData(GL_UNIFORM_BUFFER, offset, size, indices);
return static_cast<type*>(indices);
}
template <typename type>
type* EBO<type>::Map(GLenum accessType) {
return static_cast<type*>(glMapBuffer(bufferType, accessType));
}
template <typename type>
type* EBO<type>::MapRange(GLintptr offset, GLsizeiptr size, GLbitfield accessType) {
return static_cast<type*>(glMapBufferRange(bufferType, offset, size, accessType));
}
template <typename type>
void EBO<type>::Unmap() {
glUnmapBuffer(bufferType);
}
template <typename type>
void EBO<type>::Bind() {
Bind(ID);
}
template <typename type>
void EBO<type>::Bind(GLuint ID) {
glBindBuffer(bufferType, ID);
}
template <typename type>
void EBO<type>::Unbind() {
glBindBuffer(bufferType, 0);
}
template <typename type>
void EBO<type>::Delete() {
Delete(&ID);
}
template <typename type>
void EBO<type>::Delete(GLuint* ID) {
glDeleteBuffers(1, ID);
}
#endif
#endif