-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShaderProgram.h
48 lines (27 loc) · 1021 Bytes
/
ShaderProgram.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
#ifndef SHADERPROGRAM_H
#define SHADERPROGRAM_H
#include <unordered_map>
#include "common.h"
#include "LiteMath.h"
class ShaderProgram
{
public:
ShaderProgram() : shaderProgram(-1) {};
ShaderProgram(const std::unordered_map<GLenum, std::string> &inputShaders);
virtual ~ShaderProgram() {};
void Release(); //actual destructor
virtual void StartUseShader() const;
virtual void StopUseShader() const;
GLuint GetProgram() const { return shaderProgram; }
bool reLink();
void SetUniform(const std::string &location, float value) const;
void SetUniform(const std::string &location, double value) const;
void SetUniform(const std::string &location, int value) const;
void SetUniform(const std::string &location, unsigned int value) const;
void SetUniform(const std::string &location, LiteMath::float4x4) const;
private:
static GLuint LoadShaderObject(GLenum type, const std::string &filename);
GLuint shaderProgram;
std::unordered_map<GLenum, GLuint> shaderObjects;
};
#endif