-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shader.h
53 lines (46 loc) · 1.02 KB
/
Shader.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
#ifndef SHADER_HEADER
#define SHADER_HEADER
#ifdef GL_API_GLAD_OPENGL_3
#include <glad/glad.h>
#endif
#include <cstring>
#include <fstream>
#include <iostream>
struct ShaderData {
#ifdef GL_API_GLAD_OPENGL_3
const GLchar* shader;
GLuint type;
#endif
const char* name;
#ifdef GL_API_GLAD_OPENGL_3
ShaderData(const GLchar* shader, GLuint type, const char* name) {
this->shader = shader;
this->type = type;
this->name = name;
}
#endif
};
class Shader {
public:
static const unsigned int logSize = 1024;
#ifdef GL_API_GLAD_OPENGL_3
GLuint ID;
#endif
Shader(ShaderData shaders[], unsigned int numberOfShaders);
~Shader();
void Activate();
#ifdef GL_API_GLAD_OPENGL_3
static void Activate(GLuint ID);
#endif
void Delete();
#ifdef GL_API_GLAD_OPENGL_3
static void Delete(GLuint ID);
#endif
static const char* GetShaderData(const char* filename);
static void CompileErrors(unsigned int shader, const char* type);
void LinkErrors();
#ifdef GL_API_GLAD_OPENGL_3
static void LinkErrors(GLuint ID);
#endif
};
#endif