-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGLUtils.h
86 lines (72 loc) · 1.88 KB
/
GLUtils.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
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
#pragma once
#include <cstdint>
class GLShader
{
public:
unsigned m_type = 0;
unsigned m_id = -1;
GLShader(unsigned type, const char* code);
~GLShader();
private:
GLShader(const GLShader&);
};
class GLProgram
{
public:
unsigned m_id = -1;
GLProgram(const GLShader& vertexShader, const GLShader& fragmentShader);
GLProgram(const GLShader& vertexShader, const GLShader& geometryShader, const GLShader& fragmentShader);
GLProgram(const GLShader& computeShader);
~GLProgram();
private:
GLProgram(const GLProgram&);
};
class GLTexture2D
{
public:
unsigned tex_id;
GLTexture2D();
~GLTexture2D();
void load_memory_rgb(int width, int height, const uint8_t* data, bool is_srgb);
void load_memory_rgba(int width, int height, const uint8_t* data, bool is_srgb);
void load_memory_bgr(int width, int height, const uint8_t* data, bool is_srgb);
void load_memory_bgra(int width, int height, const uint8_t* data, bool is_srgb);
private:
GLTexture2D(const GLTexture2D&);
};
class GLCubemap
{
public:
unsigned tex_id;
GLCubemap();
~GLCubemap();
void load_memory_rgba(int width, int height, const uint8_t* data_xp, const uint8_t* data_xn, const uint8_t* data_yp, const uint8_t* data_yn, const uint8_t* data_zp, const uint8_t* data_zn);
private:
GLCubemap(const GLCubemap&);
};
class GLBuffer
{
public:
unsigned m_id = -1;
unsigned m_target = 0x8892;
size_t m_size = 0;
GLBuffer(size_t size, unsigned target = 0x8892 /*GL_ARRAY_BUFFER*/);
~GLBuffer();
void upload(const void* data);
const GLBuffer& operator = (const GLBuffer& in);
private:
GLBuffer(const GLBuffer&);
};
class GLDynBuffer
{
public:
unsigned m_id = -1;
unsigned m_target = 0x8892;
size_t m_size = 0;
GLDynBuffer(size_t size, unsigned target = 0x8892 /*GL_ARRAY_BUFFER*/);
~GLDynBuffer();
void upload(const void* data);
const GLDynBuffer& operator = (const GLDynBuffer& in);
private:
GLDynBuffer(const GLDynBuffer&);
};