-
Notifications
You must be signed in to change notification settings - Fork 0
/
shader.hpp
45 lines (33 loc) · 985 Bytes
/
shader.hpp
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
43
44
45
#ifndef SHADER_HHP
#define SHADER_HHP
#pragma once
#include <glad/glad.h>
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
class Shader
{
public:
// remove the basic constructor
Shader() = delete;
// remove also the copy constructor
Shader(const Shader & ) = delete ;
~Shader();
// the program ID
GLuint id ;
// the constructor that reads and build the shader
Shader(const std::string& vertexPath, const std::string& fragementPath) ;
// (use/activate) the shader
void use();
//utility uniform functions
void setBool(const std::string& name, bool value) const ;
void setInt(const std::string& name, int value) const ;
void setFloat(const std::string& name, float value) const;
private:
GLuint vertex, fragment ;
void vShaderCompilation(const char* vShaderCode) ;
void fShaderCompilation(const char* fShaderCode) ;
void shaderProgramLinker() ;
};
#endif