-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShaderProgram.hpp
More file actions
39 lines (26 loc) · 869 Bytes
/
ShaderProgram.hpp
File metadata and controls
39 lines (26 loc) · 869 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
#ifndef SHADERPROGRAM_H
#define SHADERPROGRAM_H
#include <string>
#include <vector>
#include <GL/glew.h>
#include "glm.hpp"
class Texture;
class ShaderProgram
{
public: // var locations
GLuint id;
public: // functions
ShaderProgram( const char * vertexFileName, const char * fragmentFileName );
virtual ~ShaderProgram();
void load( const char * vertexFileName, const char * fragmentFileName ); // loads, compiles and links the shaders
GLuint getUniformLocation( const char * name );
GLuint getAttribLocation( const char * name );
void use();
void draw( unsigned int count );
private: // functions
std::string readFile( const char * filePath );
GLuint compileShader( GLenum type, std::string & shaderCode);
GLuint linkProgram ( GLuint vertexShaderId, GLuint fragmentShaderId );
void getLocations();
};
#endif // SHADERPROGRAM_H