aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/main.c b/main.c
index 72c84ce..408a243 100644
--- a/main.c
+++ b/main.c
@@ -3,36 +3,22 @@
#include <GL/glew.h>
#include <GLFW/glfw3.h>
-// spir-v shaders:
const uint32_t vert_spirv[] =
-#include "spirv_vert.h"
+#include "vert_spirv.h"
;
const uint32_t frag_spirv[] =
-#include "spirv_frag.h"
+#include "frag_spirv.h"
;
-
-// glsl source:
-const char* vert_src = "\
-#version 330 core \n\
-layout (location = 0) in vec3 vert; \n\
- \n\
-void main() { \n\
- gl_Position = vec4(vert.xyz, 0.001); \n\
-} \n\
-\0";
-const char* frag_src = "\
-#version 330 core \n\
-uniform float test; \n\
- \n\
-void main() { \n\
- vec2 uv = gl_FragCoord.xy / ivec2(800, 600); \n\
- gl_FragColor = vec4(uv.xy, test, 1.0); \n\
-} \n\
-\0";
+const char vert_src[] = {
+#include "vert_src.h"
+, 0x00 };
+const char frag_src[] = {
+#include "frag_src.h"
+, 0x00 };
GLuint load_shader_src(GLenum type, const char* src) {
GLuint shader = glCreateShader(type);
- glShaderSource(shader, 1, &frag_src, NULL);
+ glShaderSource(shader, 1, &src, NULL);
glCompileShader(shader);
return shader;
}
@@ -65,7 +51,7 @@ void test(const char* label, GLuint shader) {
GLchar name[80];
GLsizei length;
glGetActiveUniformName(shader, i, 80, &length, name);
- printf("\t[%u] = \"%.*s\"\n", i, length, name);
+ printf("\t(location = %u) = \"%.*s\"\n", i, length, name);
}
// directly get uniform location