-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shader.h
58 lines (45 loc) · 863 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SHADER_H
#define SHADER_H
/**
Shader Class
**/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//OpenGL libraries
#ifdef __APPLE__
#include <GLEW/GLEW.h>
#include <GLUT/GLUT.h>
#else
#include <GL/glew.h>
#include <GL/glut.h>
#endif
using namespace std;
class Shader
{
public:
//Data members
GLuint vertexShader;
GLuint fragmentShader;
GLuint shaderProgram;
//Shader source
char* vertexShaderSource;
char* fragmentShaderSource;
//Constructor/Destructor
Shader(void);
~Shader(void);
//Load in shaders
void loadVertexShader(char* filename);
void loadFragmentShader(char* filename);
//Compilation and linking
bool compile();
//Uniforms and varying shader vars
GLint modelViewMatrix;
GLint projectionMatrix;
GLint shadowMap;
GLint vertices;
private:
char* readTextFile(char* filename);
};
#endif