diff options
| author | Ray <[email protected]> | 2021-10-31 12:28:04 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-10-31 12:28:04 +0100 |
| commit | 1fac09d0f4d409d33c0fe529b46bc8132b18ccd9 (patch) | |
| tree | 9d71b687118b39c0880e0772da50ef22c4582360 /examples/others/resources/shaders/glsl430/gol_render.glsl | |
| parent | f090f5444c274ce81bd2abcc51d18e516e352081 (diff) | |
| download | raylib-1fac09d0f4d409d33c0fe529b46bc8132b18ccd9.tar.gz raylib-1fac09d0f4d409d33c0fe529b46bc8132b18ccd9.zip | |
REVIEWED: example: Compute shader Game-of-life
Diffstat (limited to 'examples/others/resources/shaders/glsl430/gol_render.glsl')
| -rw-r--r-- | examples/others/resources/shaders/glsl430/gol_render.glsl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/others/resources/shaders/glsl430/gol_render.glsl b/examples/others/resources/shaders/glsl430/gol_render.glsl new file mode 100644 index 00000000..97a1e99e --- /dev/null +++ b/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); +} |
