aboutsummaryrefslogtreecommitdiff
path: root/raylib/examples/others/resources/shaders/glsl430/gol_render.glsl
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
commit1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 (patch)
treef5d692d046868261275c7430a624c3ea9ed75d3d /raylib/examples/others/resources/shaders/glsl430/gol_render.glsl
parenta89f892640cf12f75c7ce18e6e88c70a8d3965ed (diff)
A lot has certainly happened!
Diffstat (limited to 'raylib/examples/others/resources/shaders/glsl430/gol_render.glsl')
-rw-r--r--raylib/examples/others/resources/shaders/glsl430/gol_render.glsl29
1 files changed, 29 insertions, 0 deletions
diff --git a/raylib/examples/others/resources/shaders/glsl430/gol_render.glsl b/raylib/examples/others/resources/shaders/glsl430/gol_render.glsl
new file mode 100644
index 0000000..97a1e99
--- /dev/null
+++ b/raylib/examples/others/resources/shaders/glsl430/gol_render.glsl
@@ -0,0 +1,29 @@
+#version 430
+
+// Game of Life rendering shader
+// Just renders the content of the ssbo at binding 1 to screen
+
+#define GOL_WIDTH 768
+
+// Input vertex attributes (from vertex shader)
+in vec2 fragTexCoord;
+
+// Output fragment color
+out vec4 finalColor;
+
+// Input game of life grid.
+layout(std430, binding = 1) readonly buffer golLayout
+{
+ uint golBuffer[];
+};
+
+// Output resolution
+uniform vec2 resolution;
+
+void main()
+{
+ ivec2 coords = ivec2(fragTexCoord*resolution);
+
+ if ((golBuffer[coords.x + coords.y*uvec2(resolution).x]) == 1) finalColor = vec4(1.0);
+ else finalColor = vec4(0.0, 0.0, 0.0, 1.0);
+}