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
42 lines (27 loc) · 978 Bytes
/
Copy pathGLSLProgram.h
File metadata and controls
42 lines (27 loc) · 978 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
39
40
41
42
#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 compileShadersFromSource(const char* vertexSource, const char* fragmentSource);
void linkShaders();
void addAttribute(const std::string& attributeName);
GLint getUniformLocation(const std::string& uniformName);
void use();
void unuse();
void dispose();
private:
int _numAttributes;
void compileShader(const char* source, const std::string& name, GLuint id);
GLuint _programID;
GLuint _vertexShaderID;
GLuint _fragmentShaderID;
};
}