CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:39:19 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=cb97dccba527e45df9b2b569299d8c9732388562883da19d38dc9b77a7d746c3a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22gH7fD7G8l3Y_b90JbltcqXbrE3Gf6qlD%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d28a17bc832ffb-BLR
Game of Life fragment shader - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 330 core
- in vec2 pos;
- layout (location = 0) out vec3 frag_col;
- uniform sampler2D input_texture;
- uniform bool generate_random;
- uniform int width;
- uniform int height;
- float random (in vec2 st) {
- return fract(sin(dot(st.xy,
- vec2(12.9898,78.233)))
- * 43758.5453123);
- }
- void main() {
- int pixel_size = 2;
- ivec2 screen_pos = ivec2(pos.x * width, pos.y * height);
- if(generate_random) {
- if (random(vec2(screen_pos.x - (screen_pos.x%pixel_size), screen_pos.y - (screen_pos.y%pixel_size))) < 0.5) {
- frag_col = vec3(0.0);
- } else {
- frag_col = vec3(1.0);
- }
- return;
- }
- int wyn = 0;
- wyn += int(texture(input_texture, vec2(pos.x + (pixel_size/float(width)), pos.y + (pixel_size/float(height)))).r);
- wyn += int(texture(input_texture, vec2(pos.x - (pixel_size/float(width)), pos.y + (pixel_size/float(height)))).r);
- wyn += int(texture(input_texture, vec2(pos.x - (pixel_size/float(width)), pos.y - (pixel_size/float(height)))).r);
- wyn += int(texture(input_texture, vec2(pos.x + (pixel_size/float(width)), pos.y - (pixel_size/float(height)))).r);
- wyn += int(texture(input_texture, vec2(pos.x + (pixel_size/float(width)), pos.y)).r);
- wyn += int(texture(input_texture, vec2(pos.x - (pixel_size/float(width)), pos.y)).r);
- wyn += int(texture(input_texture, vec2(pos.x, pos.y + (pixel_size/float(height)))).r);
- wyn += int(texture(input_texture, vec2(pos.x, pos.y - (pixel_size/float(height)))).r);
- int state = int(texture(input_texture, vec2(pos.x, pos.y)).r);
- if(wyn < 2 && state == 1) frag_col = vec3(0.0);
- else if(wyn < 4 && state == 1) frag_col = vec3(1.0);
- else if(state == 1) frag_col = vec3(0.0);
- else if(wyn == 3 && state == 0) frag_col = vec3(1.0f);
- else frag_col = vec3(0.0);
- }
Tags:
glsl
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ G
JavaScript | 3 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ 7
JavaScript | 3 sec ago | 0.25 KB
-
📝 Exchange profit method
JavaScript | 4 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ U
JavaScript | 12 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch ⭐ 6
JavaScript | 12 sec ago | 0.25 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 13 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ W
JavaScript | 21 sec ago | 0.25 KB
-
✅⭐ Make huge profits on trading ⭐⭐ C
JavaScript | 21 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand