diff options
-rwxr-xr-x | blob | 4 | ||||
-rw-r--r-- | config.h | 8 | ||||
-rw-r--r-- | hello.frag | 3 | ||||
-rw-r--r-- | main.c | 3 |
4 files changed, 13 insertions, 5 deletions
@@ -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 @@ -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); @@ -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); |