From c5e99b5257dd46c90805ca43881b4665a240b986 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Sat, 17 Mar 2018 20:16:40 +0100 Subject: first complete version --- img | 5 ++- kriechstrom.png | Bin 0 -> 37990 bytes shader.frag | 106 ++++++++++++++++++++++++++++++-------------------------- sv.c | 13 +++---- void.png | Bin 0 -> 85303 bytes 5 files changed, 68 insertions(+), 56 deletions(-) create mode 100644 kriechstrom.png create mode 100644 void.png diff --git a/img b/img index 5952e2c..97502f7 100644 --- a/img +++ b/img @@ -1,7 +1,10 @@ /home/ch/images/art/20130113_164429.JPG -vns.png +kriechstrom.png /home/ch/images/art/20171202_151804.JPG /home/ch/images/art/20171202_151612.JPG +void.png /home/ch/images/art/20130113_164510.JPG /home/ch/images/art/20171014_092615.JPG /home/ch/images/art/20171202_151645.JPG +vns.png +vns-invert.png diff --git a/kriechstrom.png b/kriechstrom.png new file mode 100644 index 0000000..fa3d00d Binary files /dev/null and b/kriechstrom.png differ diff --git a/shader.frag b/shader.frag index eda981e..60d5e50 100644 --- a/shader.frag +++ b/shader.frag @@ -39,6 +39,13 @@ vec2 translate(vec2 st, vec2 amount) { return st; } +vec2 rotate(vec2 st, float angle) { + st -= 0.5; + st *= angle; + st += 0.5; + return st; +} + mat2 rotate2d(float _angle){ return mat2(cos(_angle),-sin(_angle), sin(_angle),cos(_angle)); } @@ -47,88 +54,89 @@ void main (void) { vec4 img; vec2 coord; if (program == 0) { - coord = zoom(st(),0.5-0.5*(1.0-params[0])); + coord = zoom(st(),1.0-0.5*(1.0-params[0])); img = texture2D(images[0],coord); - img -= params[1]*(1.0-texture2D(images[1],st())); + vec2 tc = st(); + tc = zoom(tc,2.0); + tc.y *= 1.5; + tc = translate(tc,vec2(-0.35,0.55)); + vec4 title = texture2D(images[1],tc); + img -= params[1]*0.7*title; } 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])); + coord = zoom(st(),1.0-0.5*(1.0-params[0])); img = texture2D(images[0],coord); - coord = zoom(st(),0.5-0.5*(1.0-params[0])); + coord = zoom(st(),1.0-0.5*(1.0-params[2])); + coord = translate(coord,vec2(-0.1,-0.1)); 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); + img.rgb = pow((1.0-2.3*img.rgb),1.0+(1.0-params[1])*2*i2); } else if (program == 2) { - coord = zoom(st(),(1.0-1.5*params[2])); + coord = zoom(st(),1.0-0.5*(1.0-params[2])); + coord = translate(coord,vec2(-0.1,-0.1)); + img = texture2D(images[2],coord); + coord = zoom(st(),1.0-0.5*(1.0-params[0])); + vec3 i2 = texture2D(images[0],coord).rgb; + img.rgb = pow((1.0-2.3*img.rgb),1.0+(1.0-params[1])*2*i2); + } + else if (program == 3) { + coord = zoom(st(),1.0-0.5*(1.0-params[0])); + coord = rotate(coord,0.1); 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 = zoom(st(),0.7-0.5*(1.0-params[2])); + coord = translate(coord,vec2(-0.1,0.2)); vec3 i2 = texture2D(images[2],coord).rgb; - img.rgb = pow((1.0-2.0*i2),params[3]*5*img.rgb); + img.rgb = pow((1.0-2.3*img.rgb),params[3]*5*i2); /* - 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 == 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); - /* - */ + vec3 i2 = texture2D(images[0],coord).rgb; + img.rgb = 2.0*pow((1.0-2.0*i2),params[3]*50*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 = 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; + coord = rotate(coord,-0.1); vec3 i2 = texture2D(images[2],coord).rgb; - img.rgb = pow(img.rgb,i2); + img.rgb = pow((1.0-2.3*img.rgb),params[3]*5*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; + coord = translate(coord,vec2(0.2,0.15)); + vec3 i2 = texture2D(images[3],coord).rgb; + img.rgb = pow(img.rgb,5*i2); + } + else if (program == 6) { + coord = zoom(st(),(1.0-1.5*params[0])); + img = texture2D(images[2],coord); + coord = zoom(st(),0.5*(1.0-0.5*params[2])); + coord = translate(coord,vec2(0.2,0.15)); vec3 i2 = texture2D(images[3],coord).rgb; img.rgb = pow(img.rgb,5*i2); + vec2 tc = st(); + tc = zoom(tc,2.0); + tc.y *= 1.5; + tc = translate(tc,vec2(-0.35,0.15)); + vec4 title = texture2D(images[1],tc); + tc = st(); + tc = zoom(tc,2.0); + tc = translate(tc,vec2(-0.35,0.35)); + tc.y *= 3.5; + vec4 subtitle = texture2D(images[4],tc); + img += params[3]*title + subtitle; } imageStore(backbuffer,ist(),img); if (program != 0) { vec4 feedback = imageLoad(backbuffer,ist()); - img = mix(feedback,img,0.5); + img = mix(feedback,img,0.4); } fragColor = img; /* diff --git a/sv.c b/sv.c index 11b6b0c..7cdfa20 100644 --- a/sv.c +++ b/sv.c @@ -18,8 +18,6 @@ int width = 1918; int height = 1078; -//int width = 800; -//int height = 640; GLFWwindow* window; GLuint vertex; GLuint fragment; @@ -175,10 +173,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); @@ -260,6 +258,9 @@ int main(int argc, char **argv) { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_DECORATED, GL_FALSE); + const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + width = mode->width; + height = mode->height; if (fullscreen) { window = glfwCreateWindow(width,height, "", glfwGetPrimaryMonitor(), NULL); } else { diff --git a/void.png b/void.png new file mode 100644 index 0000000..3684b61 Binary files /dev/null and b/void.png differ -- cgit 1.4.1