-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShaderProgram.h
More file actions
41 lines (31 loc) · 1.01 KB
/
ShaderProgram.h
File metadata and controls
41 lines (31 loc) · 1.01 KB
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
#pragma once
#ifdef _WINDOWS
#include <GL/glew.h>
#endif
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengl.h>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include "glm/mat4x4.hpp"
class ShaderProgram {
public:
void Load(const char *vertexShaderFile, const char *fragmentShaderFile);
void Cleanup();
void SetModelMatrix(const glm::mat4 &matrix);
void SetProjectionMatrix(const glm::mat4 &matrix);
void SetViewMatrix(const glm::mat4 &matrix);
void SetColor(float r, float g, float b, float a);
GLuint LoadShaderFromString(const std::string &shaderContents, GLenum type);
GLuint LoadShaderFromFile(const std::string &shaderFile, GLenum type);
GLuint programID;
GLuint projectionMatrixUniform;
GLuint modelMatrixUniform;
GLuint viewMatrixUniform;
GLuint colorUniform;
GLuint positionAttribute;
GLuint texCoordAttribute;
GLuint vertexShader;
GLuint fragmentShader;
};