summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--img7
-rw-r--r--shader.frag72
-rw-r--r--sv.c8
-rw-r--r--vns.pngbin0 -> 12268 bytes
4 files changed, 77 insertions, 10 deletions
diff --git a/img b/img
new file mode 100644
index 0000000..5952e2c
--- /dev/null
+++ b/img
@@ -0,0 +1,7 @@
+/home/ch/images/art/20130113_164429.JPG
+vns.png
+/home/ch/images/art/20171202_151804.JPG
+/home/ch/images/art/20171202_151612.JPG
+/home/ch/images/art/20130113_164510.JPG
+/home/ch/images/art/20171014_092615.JPG
+/home/ch/images/art/20171202_151645.JPG
diff --git a/shader.frag b/shader.frag
index f76c968..eda981e 100644
--- a/shader.frag
+++ b/shader.frag
@@ -47,29 +47,89 @@ void main (void) {
vec4 img;
vec2 coord;
if (program == 0) {
- //coord = zoom(st(),0.5*(1.0-params[0]));
- coord = zoom(st(),sin(time));
+ coord = zoom(st(),0.5-0.5*(1.0-params[0]));
img = texture2D(images[0],coord);
img -= params[1]*(1.0-texture2D(images[1],st()));
}
else if (program == 1) {
+ coord = translate(coord,vec2(0.5,0.5));
+ coord = zoom(coord,2.5);
+ coord = translate(coord,vec2(-0.5,-0.5));
+ //coord = zoom(st(),0.5);
+ //coord = zoom(coord,2.1*(1.0-0.5*params[0]));
+ //coord = zoom(st(),0.5-0.5*(1.0-params[0]));
+ //coord = zoom(st(),(1.0-1.5*params[2]));
+ //coord = translate(coord,vec2(0,params[0]));
+ img = texture2D(images[0],coord);
+ coord = zoom(st(),0.5-0.5*(1.0-params[0]));
+ vec3 i2 = texture2D(images[2],coord).rgb;
+ //img.rgb = pow((1.0-2.0*i2),img.rgb+0.6);
+ img.rgb = pow(img.rgb,1.0-i2);
+ }
+ else if (program == 2) {
+ coord = zoom(st(),(1.0-1.5*params[2]));
+ img = texture2D(images[3],coord);
+ coord = zoom(st(),0.5*(1.0-0.5*params[0]));
+ coord = translate(coord,vec2(0.2,0.15));
+ vec3 i2 = texture2D(images[2],coord).rgb;
+ img.rgb = pow((1.0-2.0*i2),params[3]*5*img.rgb);
+ /*
coord = zoom(st(),(1.0-1.5*params[0]));
img = texture2D(images[3],coord);
coord = zoom(st(),0.5*(1.0-0.5*params[2]));
+ coord += 0.5;
+ coord *= rotate2d(params[3]-0.5);
+ coord -= 0.5;
vec3 i2 = texture2D(images[2],coord).rgb;
img.rgb = pow(img.rgb,5*i2);
+ */
}
- else if (program == 2) {
+ else if (program == 3) {
+ coord = st() + 0.5;
+ coord -= 0.5;
+ img = texture2D(images[3],coord);
+ coord = zoom(st(),0.5*(1.0-0.5*params[0]));
+ //coord = translate(coord,vec2(0.2,0.15));
+ //coord = rotate2d(1.0-1.5*params[2])*coord;
+ coord = rotate2d(sin(ticks))*coord;
+ vec3 i2 = texture2D(images[2],coord).rgb;
+ img.rgb = pow((1.0-2.0*i2),params[3]*5*img.rgb);
+ /*
+ */
+ }
+ else if (program == 4) {
coord = zoom(st(),(1.0-1.5*params[0]));
+ coord = rotate2d(ticks)*coord;
+ coord = translate(coord,vec2(0.5,0.5));
img = texture2D(images[3],coord);
coord = zoom(st(),0.5*(1.0-0.5*params[2]));
- coord *= rotate2d(ticks);
+ coord = translate(coord,vec2(0.2,0.15));
+ coord = rotate2d(1.0-1.5*params[2])*coord;
+ //coord += 0.5;
+ //coord *= rotate2d(params[3]-0.5);
+ //coord -= 0.5;
vec3 i2 = texture2D(images[2],coord).rgb;
+ img.rgb = pow(img.rgb,i2);
+ }
+ else if (program == 5) {
+ coord = zoom(st(),(1.0-1.5*params[0]));
+ coord = rotate2d(ticks)*coord;
+ coord = translate(coord,vec2(0.5,0.5));
+ img = texture2D(images[2],coord);
+ coord = zoom(st(),0.5*(1.0-0.5*params[2]));
+ //coord = translate(coord,vec2(0.2,0.15));
+ coord = rotate2d(1.0-1.5*params[2])*coord;
+ //coord += 0.5;
+ //coord *= rotate2d(params[3]-0.5);
+ //coord -= 0.5;
+ vec3 i2 = texture2D(images[3],coord).rgb;
img.rgb = pow(img.rgb,5*i2);
}
- vec4 feedback = imageLoad(backbuffer,ist());
- img = mix(img,feedback,0.5);
imageStore(backbuffer,ist(),img);
+ if (program != 0) {
+ vec4 feedback = imageLoad(backbuffer,ist());
+ img = mix(feedback,img,0.5);
+ }
fragColor = img;
/*
fragColor = vec4(params[1]);
diff --git a/sv.c b/sv.c
index ec554e5..11b6b0c 100644
--- a/sv.c
+++ b/sv.c
@@ -175,10 +175,10 @@ void readImage(int i) {
glBindTexture(GL_TEXTURE_2D,images[i].id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
+ //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
diff --git a/vns.png b/vns.png
new file mode 100644
index 0000000..3b998d9
--- /dev/null
+++ b/vns.png
Binary files differ