-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shader.hpp
38 lines (28 loc) · 1004 Bytes
/
Shader.hpp
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
#pragma once
#include <string>
#include <string.h>
#include <fstream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
namespace shader
{
class Shader
{
public:
Shader();
// Cria o `Program` para ser utilizado quando for realizado o desenho.
void CreateFromString(const char* vertexCode, const char* fragmentCode);
void CreateFromFiles(const char* vertexLocation, const char* fragmentLocation);
std::string ReadFile(const char* fileLocation);
GLuint GetProjectionLocation();
GLuint GetModelLocation();
GLuint GetViewLocation();
void UseShader();
void ClearShader();
~Shader();
private:
GLuint shaderID, uniformProjection, uniformModel, uniformView;
void CompileShader(const char* vertexCode, const char* fragmentCode);
void AddShader(GLuint theProgram, const char* shaderCode, GLenum shaderType);
};
}