aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fill.vert10
-rw-r--r--hello.vert7
-rw-r--r--main.c12
-rw-r--r--makefile8
-rw-r--r--visuals.frag (renamed from hello.frag)0
5 files changed, 20 insertions, 17 deletions
diff --git a/fill.vert b/fill.vert
new file mode 100644
index 0000000..5633fd5
--- /dev/null
+++ b/fill.vert
@@ -0,0 +1,10 @@
+#version 330 core
+layout (location = 0) in vec3 vert;
+
+void main() {
+ // Setting w to 0 has the effect of an infinitely large zoom, which makes the
+ // single triangle fill the viewport completely. This is okay since I only
+ // care about the fragment shader.
+ gl_Position = vec4(vert.xyz, 0.0);
+}
+
diff --git a/hello.vert b/hello.vert
deleted file mode 100644
index 4af0bdf..0000000
--- a/hello.vert
+++ /dev/null
@@ -1,7 +0,0 @@
-#version 330 core
-layout (location = 0) in vec3 aPos;
-
-void main() {
- gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
-}
-
diff --git a/main.c b/main.c
index 0ff0706..09cf2fb 100644
--- a/main.c
+++ b/main.c
@@ -6,14 +6,14 @@
#include "die.h"
#include "config.h"
-#include "hello_vert.h"
-#include "hello_frag.h"
+#include "fill_vert.h"
+#include "visuals_frag.h"
void prepare_tri() {
const float vertices[] = {
+ 0, 1, 0,
+ 1, -1, 0,
-1, -1, 0,
- 3, -1, 0,
- -1, 3, 0,
};
// initialize vertex {buffer,attribute} object buffers
@@ -59,8 +59,8 @@ int main(int argc, char** argv) {
// prepare shaders
GLuint shader = link_shaders(
- vert_shader(hello_vert, hello_vert_size),
- frag_shader(hello_frag, hello_frag_size)
+ vert_shader(fill_vert, fill_vert_size),
+ frag_shader(visuals_frag, visuals_frag_size)
);
// main draw loop
diff --git a/makefile b/makefile
index 34c19bf..fa39ee9 100644
--- a/makefile
+++ b/makefile
@@ -12,12 +12,12 @@ all: main FORCE
main: main.o
main: die.o
main: shader.o
-main: hello_frag.o
-main: hello_vert.o
+main: visuals_frag.o
+main: fill_vert.o
# fix compile order
-main.o: hello_vert.h
-main.o: hello_frag.h
+main.o: fill_vert.h
+main.o: visuals_frag.h
%.s %.h &: %.spv
./blob $< $*
diff --git a/hello.frag b/visuals.frag
index 3539bdc..3539bdc 100644
--- a/hello.frag
+++ b/visuals.frag