-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshader.h
40 lines (35 loc) · 945 Bytes
/
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
#ifndef _H_SHADER_
#define _H_SHADER_
#include <map>
#include <string>
class shader
{
private:
unsigned int mHandle;
std::map<std::string, unsigned int> mAttributes;
std::map<std::string, unsigned int> mUniforms;
private:
std::string ReadFile(const std::string& path);
unsigned int CompileVertexShader(
const std::string& vertex);
unsigned int CompileFragmentShader(
const std::string& fragment);
bool LinkShaders(unsigned int vertex,
unsigned int fragment);
void PopulateAttributes();
void PopulateUniforms();
private:
shader(const shader&);
shader& operator=(const shader&);
public:
shader();
shader(const std::string& vertex, const std::string& fragment);
~shader();
void Load(const std::string& vertex, const std::string& fragment);
void Bind();
void UnBind();
unsigned int GetAttribute(const std::string& name);
unsigned int GetUniform(const std::string& name);
unsigned int GetHandle();
};
#endif //h_shader