-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOpenGLShaderProgram.h
44 lines (35 loc) · 1.04 KB
/
OpenGLShaderProgram.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
#pragma once
#include "ShaderMaterial.h" // Move uniforms?
#include <GL/glew.h>
#include <boost/shared_ptr.hpp>
namespace dawn
{
class OpenGLShaderProgram
{
public:
OpenGLShaderProgram();
OpenGLShaderProgram(const std::string &vs, const std::string &fs);
OpenGLShaderProgram(GLuint program);
~OpenGLShaderProgram();
void Bind();
void uniform(const std::string &name, GLint v0);
void uniform(const std::string &name, GLfloat v0);
void uniform(const std::string &name, vec2f v);
void uniform(const std::string &name, vec3f v);
void uniform(const std::string &name, vec4f v);
void uniform(const std::string &name, mat3f m);
void uniform(const std::string &name, mat4f m);
enum AttributeLocation
{
POSITION = 0,
COLOR,
UV
};
private:
GLint GetUniformLocation(const std::string &name);
GLuint program;
typedef std::map<std::string, GLint> UniformLUTMap;
UniformLUTMap uniformLUT;
};
typedef boost::shared_ptr<OpenGLShaderProgram> OpenGLShaderProgramPtr;
}