-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShaderProgram.h
49 lines (37 loc) · 1.39 KB
/
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
49
#ifndef SHADERPROGRAM_H
#define SHADERPROGRAM_H
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "Shader.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Matrix4.h"
#include "IGLBindable.h"
class ShaderProgram : public IGLIdable
,public IGLBindable
,public IToString
{
private:
Shader *m_vshader;
Shader *m_fshader;
public:
ShaderProgram();
ShaderProgram(const std::string &vshaderPath,
const std::string &fshaderPath);
virtual ~ShaderProgram();
void BindVertexShader(Shader *vshader);
void BindFragmentShader(Shader *fshader);
bool Link();
void Bind() const override;
void UnBind() const override;
bool SetUniformFloat (const std::string &name, float v, bool warn = false) const;
bool SetUniformVec3 (const std::string &name, const Vector3& v, bool warn = false) const;
bool SetUniformVec4 (const std::string &name, const Vector4& v, bool warn = false) const;
bool SetUniformMat4 (const std::string &name, const Matrix4& m, bool warn = false) const;
Shader* GetVertexShader() const;
Shader* GetFragmentShader() const;
GLint GetUniformLocation(const std::string &name) const;
GLint GetAttribLocation(const std::string &name) const;
const std::string ToString() const override;
};
#endif // SHADERPROGRAM_H