blob: e253f50dc5afda273800b0341799a936049c7ba5 (
plain)
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
|
#ifndef SHADER_INCLUDED_H
#define SHADER_INCLUDED_H
#include <GL/glew.h>
#include <glRef.hpp>
#include <string_view>
class Camera;
class Transform;
class Shader {
public:
Shader();
void Bind() const;
void Update(const Transform & transform, const Camera & camera) const;
private:
class Source {
public:
using ShaderRef = glRef<GLuint, __glewCreateShader, __glewDeleteShader>;
Source(const std::basic_string_view<unsigned char> text, GLuint type);
Source(const GLchar * text, GLint len, GLuint type);
ShaderRef id;
};
static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage);
using ProgramRef = glRef<GLuint, __glewCreateProgram, __glewDeleteProgram>;
ProgramRef m_program;
GLint mvp_uniform, normal_uniform, lightDir_uniform;
};
#endif
|