-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRBO.cpp
53 lines (40 loc) · 1.06 KB
/
RBO.cpp
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
#include "RBO.h"
#ifdef GL_API_GLAD_OPENGL_3
RBO::RBO(GLenum type, GLsizei width, GLsizei height) {
Init(type, width, height);
}
RBO::~RBO() {
Delete();
}
void RBO::Init(GLenum type, GLsizei width, GLsizei height) {
Init(&ID, type, width, height, &this->width, &this->height);
}
void RBO::Init(GLuint* ID, GLenum type, GLsizei width, GLsizei height, GLsizei* widthVar, GLsizei* heightVar) {
glGenRenderbuffers(1, ID);
Bind(*ID);
Data(type, width, height, widthVar, heightVar);
}
void RBO::Data(GLenum type, GLsizei width, GLsizei height) {
Data(type, width, height, &this->width, &this->height);
}
void RBO::Data(GLenum type, GLsizei width, GLsizei height, GLsizei* widthVar, GLsizei* heightVar) {
*widthVar = width;
*heightVar = height;
glRenderbufferStorage(bufferType, type, width, height);
}
void RBO::Bind() {
Bind(ID);
}
void RBO::Bind(GLuint ID) {
glBindRenderbuffer(bufferType, ID);
}
void RBO::Unbind() {
glBindRenderbuffer(bufferType, 0);
}
void RBO::Delete() {
Delete(&ID);
}
void RBO::Delete(GLuint* ID) {
glDeleteRenderbuffers(1, ID);
}
#endif