-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUBO.cpp
More file actions
57 lines (42 loc) · 1 KB
/
UBO.cpp
File metadata and controls
57 lines (42 loc) · 1 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
#include "UBO.h"
#ifdef GL_API_GLAD_OPENGL_3
UBO::~UBO() {
Delete();
}
void UBO::Unmap() {
glUnmapBuffer(bufferType);
}
void UBO::Bind() {
Bind(ID);
}
void UBO::Bind(GLuint ID) {
glBindBuffer(bufferType, ID);
}
void UBO::Unbind() {
glBindBuffer(bufferType, 0);
}
void UBO::BindBase(GLuint index) {
BindBase(ID, index);
}
void UBO::BindBase(GLuint ID, GLuint index) {
glBindBufferBase(bufferType, index, ID);
}
void UBO::BindRange(GLuint index, GLuint offset, GLsizeiptr size) {
BindRange(ID, index, offset, size);
}
void UBO::BindRange(GLuint ID, GLuint index, GLuint offset, GLsizeiptr size) {
glBindBufferRange(bufferType, index, ID, offset, size);
}
void UBO::UnbindRange(GLuint index, GLuint offset, GLsizeiptr size) {
glBindBufferRange(bufferType, index, 0, offset, size);
}
GLint UBO::GetUniformLocation(GLuint shader, const GLchar* uniform) {
return glGetUniformBlockIndex(shader, uniform);
}
void UBO::Delete() {
Delete(&ID);
}
void UBO::Delete(GLuint* ID) {
glDeleteBuffers(1, ID);
}
#endif