forked from Barnold1953/GraphicsTutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGLSLProgram.h
More file actions
38 lines (25 loc) · 843 Bytes
/
Copy pathGLSLProgram.h
File metadata and controls
38 lines (25 loc) · 843 Bytes
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
#pragma once
#include <string>
#include <GL/glew.h>
namespace Bengine {
//This class handles the compilation, linking, and usage of a GLSL shader program.
//Reference: http://www.opengl.org/wiki/Shader_Compilation
class GLSLProgram
{
public:
GLSLProgram();
~GLSLProgram();
void compileShaders(const std::string& vertexShaderFilePath, const std::string& fragmentShaderFilepath);
void linkShaders();
void addAttribute(const std::string& attributeName);
GLint getUniformLocation(const std::string& uniformName);
void use();
void unuse();
private:
int _numAttributes;
void compileShader(const std::string& filePath, GLuint id);
GLuint _programID;
GLuint _vertexShaderID;
GLuint _fragmentShaderID;
};
}