From ef4a5089bffbdd20691a281ec2fc1bf41ce446ec Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 31 Mar 2014 09:41:05 -0400 Subject: [PATCH] updated conway example --- .../examples/Topics/Shaders/Conway/Conway.pde | 4 ++-- .../Topics/Shaders/Conway/data/conway.glsl | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/java/examples/Topics/Shaders/Conway/Conway.pde b/java/examples/Topics/Shaders/Conway/Conway.pde index 472b6c758..529f821b0 100644 --- a/java/examples/Topics/Shaders/Conway/Conway.pde +++ b/java/examples/Topics/Shaders/Conway/Conway.pde @@ -1,7 +1,7 @@ // GLSL version of Conway's game of life, ported from GLSL sandbox: // http://glsl.heroku.com/e#207.3 -// Exemplifies the use of the buffer uniform in the shader, that gives -// access to the previous frame. +// Exemplifies the use of the ppixels uniform in the shader, that gives +// access to the pixels of the previous frame. PShader conway; PGraphics pg; diff --git a/java/examples/Topics/Shaders/Conway/data/conway.glsl b/java/examples/Topics/Shaders/Conway/data/conway.glsl index dca8dfd7f..694491ef0 100644 --- a/java/examples/Topics/Shaders/Conway/data/conway.glsl +++ b/java/examples/Topics/Shaders/Conway/data/conway.glsl @@ -9,7 +9,7 @@ precision highp float; uniform float time; uniform vec2 mouse; uniform vec2 resolution; -uniform sampler2D buffer; +uniform sampler2D ppixels; vec4 live = vec4(0.5,1.0,0.7,1.); vec4 dead = vec4(0.,0.,0.,1.); @@ -28,15 +28,15 @@ void main( void ) { } } else { float sum = 0.; - sum += texture2D(buffer, position + pixel * vec2(-1., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(-1., 0.)).g; - sum += texture2D(buffer, position + pixel * vec2(-1., 1.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., 0.)).g; - sum += texture2D(buffer, position + pixel * vec2(1., 1.)).g; - sum += texture2D(buffer, position + pixel * vec2(0., -1.)).g; - sum += texture2D(buffer, position + pixel * vec2(0., 1.)).g; - vec4 me = texture2D(buffer, position); + sum += texture2D(ppixels, position + pixel * vec2(-1., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(-1., 0.)).g; + sum += texture2D(ppixels, position + pixel * vec2(-1., 1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., 0.)).g; + sum += texture2D(ppixels, position + pixel * vec2(1., 1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(0., -1.)).g; + sum += texture2D(ppixels, position + pixel * vec2(0., 1.)).g; + vec4 me = texture2D(ppixels, position); if (me.g <= 0.1) { if ((sum >= 2.9) && (sum <= 3.1)) {