-
Notifications
You must be signed in to change notification settings - Fork 0
/
UBO.h
59 lines (53 loc) · 1.75 KB
/
UBO.h
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
#ifndef UBO_HEADER
#define UBO_HEADER
#ifdef GL_API_GLAD_OPENGL_3
#include <glad/glad.h>
#endif
class UBO {
public:
#ifdef GL_API_GLAD_OPENGL_3
static const GLenum bufferType = GL_UNIFORM_BUFFER;
GLuint ID;
#endif
#ifdef GL_API_GLAD_OPENGL_3
template <typename type>
UBO(type* data, GLsizeiptr size, GLenum howUse, const GLchar* name, GLuint shader, GLuint index);
#endif
~UBO();
#ifdef GL_API_GLAD_OPENGL_3
template <typename type>
void Init(type* data, GLsizeiptr size, GLenum howUse, const GLchar* name, GLuint shader, GLuint index);
template <typename type>
static void Init(GLuint* ID, type* data, GLsizeiptr size, GLenum howUse, const GLchar* name, GLuint shader, GLuint index);
template <typename type>
static void Data(type* data, GLsizeiptr size, GLenum howUse);
template <typename type>
static void SubData(type* data, GLintptr offset, GLsizeiptr size);
template <typename type>
static type* GetSubData(GLintptr offset, GLsizeiptr size);
template <typename type>
static type* Map(GLenum accessType);
template <typename type>
static type* MapRange(GLintptr offset, GLsizeiptr size, GLbitfield accessType);
#endif
static void Unmap();
void Bind();
#ifdef GL_API_GLAD_OPENGL_3
static void Bind(GLuint ID);
#endif
static void Unbind();
#ifdef GL_API_GLAD_OPENGL_3
void BindBase(GLuint index);
static void BindBase(GLuint ID, GLuint index);
void BindRange(GLuint index, GLuint offset, GLsizeiptr size);
static void BindRange(GLuint ID, GLuint index, GLuint offset, GLsizeiptr size);
static void UnbindRange(GLuint index, GLuint offset, GLsizeiptr size);
static GLint GetUniformLocation(GLuint shader, const GLchar* uniform);
#endif
void Delete();
#ifdef GL_API_GLAD_OPENGL_3
static void Delete(GLuint* ID);
#endif
};
#include "UBO.tpp"
#endif