summary refs log tree commit diff
path: root/src/GFX/Shading/Shader.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-10-23 21:28:09 +0200
committerMel <einebeere@gmail.com>2022-10-23 21:28:09 +0200
commitad84d0686f1d7f72e86b55cdadd8272f225f776d (patch)
tree4d3cb6fbc48f41126407d10eac3d835c1b2d0a91 /src/GFX/Shading/Shader.cpp
parent75a9c87b50cef2f1d749bd9042a9348bc28b4c09 (diff)
downloadmeowcraft-ad84d0686f1d7f72e86b55cdadd8272f225f776d.tar.zst
meowcraft-ad84d0686f1d7f72e86b55cdadd8272f225f776d.zip
Modular mesh vertex attributes
Diffstat (limited to 'src/GFX/Shading/Shader.cpp')
-rw-r--r--src/GFX/Shading/Shader.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/GFX/Shading/Shader.cpp b/src/GFX/Shading/Shader.cpp
index ff954a5..f1502c2 100644
--- a/src/GFX/Shading/Shader.cpp
+++ b/src/GFX/Shading/Shader.cpp
@@ -4,8 +4,18 @@
 
 namespace MC::GFX::Shading {
 
-Shader::Shader(uint32_t type, const char* source) {
-    m_shader = glCreateShader(type);
+Shader::Shader(Shader::Type type, const char* source) {
+    uint32_t gl_type;
+    switch (type) {
+        case Type::Vertex:
+            gl_type = GL_VERTEX_SHADER;
+            break;
+        case Type::Fragment:
+            gl_type = GL_FRAGMENT_SHADER;
+            break;
+    }
+
+    m_shader = glCreateShader(gl_type);
 
     glShaderSource(m_shader, 1, &source, nullptr);
     glCompileShader(m_shader);