-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshader.h
More file actions
24 lines (20 loc) · 769 Bytes
/
shader.h
File metadata and controls
24 lines (20 loc) · 769 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
#pragma once
#include <string>
#include <glad/glad.h>
#include <glm/glm.hpp>
// OpenGL program abstraction.
// Compiles shaders, keeps track of the program id, and provides an interface to
// set uniforms and enable the program.
// Modeled after:
// https://github.com/JoeyDeVries/LearnOpenGL/blob/master/includes/learnopengl/shader.h
class Shader {
public:
GLuint id;
Shader(const char *path_vert, const char *path_frag);
~Shader();
void use() const;
void set_int(const std::string &name, GLint value) const;
void set_float(const std::string &name, GLfloat value) const;
void set_mat4fv(const std::string &name, const glm::mat4 &mat) const;
void attr(const std::string &name, GLint size, GLenum type, GLsizei stride, const void * pointer) const;
};