aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xblob4
-rw-r--r--config.h8
-rw-r--r--hello.frag3
-rw-r--r--main.c3
4 files changed, 13 insertions, 5 deletions
diff --git a/blob b/blob
index 6baae9c..e0f4b4c 100755
--- a/blob
+++ b/blob
@@ -18,8 +18,8 @@ cat << EOF > "$base.h"
#include <stddef.h>
extern const char ${symbol_base}_head;
-const char* ${symbol_base} = &${symbol_base}_head;
-const size_t ${symbol_base}_size = $(wc -c < "$input");
+static const char* ${symbol_base} = &${symbol_base}_head;
+static const size_t ${symbol_base}_size = $(wc -c < "$input");
EOF
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..5f0a76a
--- /dev/null
+++ b/config.h
@@ -0,0 +1,8 @@
+// glsl doesn't support #pragma once
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#define WIDTH 800
+#define HEIGHT 600
+
+#endif
diff --git a/hello.frag b/hello.frag
index 291c0f1..3539bdc 100644
--- a/hello.frag
+++ b/hello.frag
@@ -1,7 +1,6 @@
#version 330 core
-#define WIDTH 800
-#define HEIGHT 600
+#include "config.h"
void main() {
gl_FragColor = vec4(gl_FragCoord.x / WIDTH, gl_FragCoord.y / HEIGHT, 0, 1);
diff --git a/main.c b/main.c
index c7a156b..0ff0706 100644
--- a/main.c
+++ b/main.c
@@ -4,6 +4,7 @@
#include "shader.h"
#include "die.h"
+#include "config.h"
#include "hello_vert.h"
#include "hello_frag.h"
@@ -45,7 +46,7 @@ int main(int argc, char** argv) {
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
// initialize window
- GLFWwindow* window = glfwCreateWindow(800, 600, "vis", NULL, NULL);
+ GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "vis", NULL, NULL);
if (window == NULL)
die("error: could not create window\n");
glfwMakeContextCurrent(window);