blob: 0810e6b9e0d2a5282da541b20286199ff82c68c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include <glRef.h>
#include <glad/gl.h>
#include <optional>
#include <string_view>
class Shader {
public:
using ShaderRef = glRef<GLuint, &glCreateShader, &glDeleteShader>;
constexpr Shader(const GLchar * text, GLint len, GLuint type) : text {text}, len {len}, type {type} { }
[[nodiscard]] ShaderRef compile() const;
static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage);
private:
const GLchar * text;
GLint len;
GLuint type;
};
|