forked from githole/Live-Coder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShaderGL.h
55 lines (41 loc) · 994 Bytes
/
ShaderGL.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
50
51
52
53
54
55
#ifndef _SHADER_H_
#define _SHADER_H_
#ifdef __WIN32__
#include <windows.h>
#endif __WIN32__
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include <stdio.h>
#include <string>
#include <set>
#include "Logger.h"
namespace LiveCoder {
class ShaderGL {
private:
bool OK;
GLuint shaderProgram;
std::set<int> errorLinesFS;
std::set<int> errorLinesVS;
public:
ShaderGL();
virtual ~ShaderGL();
const std::set<int>& GetErrorLinesFS() { return errorLinesFS; }
const std::set<int>& GetErrorLinesVS() { return errorLinesVS; }
GLuint Compile(const std::string& fsshader);
GLuint CompileFromFile(const std::string& filename);
bool Valid();
void Bind();
void Unbind();
void SetUniform(const GLchar* name, int i);
void SetUniform(const GLchar* name, float v);
void SetUniform(const GLchar* name, float* fv, int size);
void SetUniform(const GLchar* name, float x, float y);
};
};
#endif