1 | #include <GL/gl3w.h> |
2 |
|
3 | #include "GLShader.hpp" |
4 |
|
5 |
|
6 | GLShader::GLShader(uint64_t shader_type, const char *shader_source) |
7 | { |
8 | m_glShaderId = glCreateShader(shader_type); |
9 | glShaderSource(m_glShaderId, 1, &shader_source, nullptr); |
10 | glCompileShader(m_glShaderId); |
11 |
|
12 | int success; |
13 | char infoLog[512]; |
14 | glGetShaderiv(m_glShaderId, GL_COMPILE_STATUS, &success); |
15 | if (!success) |
16 | { |
17 | glGetShaderInfoLog(m_glShaderId, 512, nullptr, infoLog); |
18 | ZydecoFault("Shader compilation failed (type {}):\n{}", shader_type, infoLog); |
19 | } |
20 | } |
21 |
|
22 | GLShader::~GLShader() |
23 | { |
24 | glDeleteShader(m_glShaderId); |
25 | } |
26 |
|
27 | uint64_t GLShader::GetGLShaderID() |
28 | { |
29 | return m_glShaderId; |
30 | } |
31 |
|