From 2cf5b8ef6bace1fa7e984b41fdd3254784b6df4b Mon Sep 17 00:00:00 2001 From: micuat Date: Fri, 6 Nov 2020 16:29:21 +0100 Subject: [PATCH] zone a test --- zoneb/bin/data/shaders/bound.frag | 8 ++++++-- zoneb/src/ofApp.cpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zoneb/bin/data/shaders/bound.frag b/zoneb/bin/data/shaders/bound.frag index 8de7a4d..becac65 100644 --- a/zoneb/bin/data/shaders/bound.frag +++ b/zoneb/bin/data/shaders/bound.frag @@ -9,6 +9,7 @@ uniform sampler2DRect u_energy; uniform sampler2DRect u_v4l2cam; uniform sampler2DRect u_buffer0; uniform sampler2DRect u_buffer1; +uniform sampler2DRect u_gradient; uniform bool u_calib; uniform vec2 u_calibXY; @@ -166,9 +167,12 @@ void main() { depth.r *= 100; depth.a = 0; // vec4 v4l2 = texture(u_v4l2cam, st); - vec4 v4l2 = texture(u_v4l2cam, (st + vec2(300, 0)) / 3.5 + vec2(-10, 86)); + vec4 v4l2 = texture(u_v4l2cam, (st + vec2(300, 0)) / vec2(3.7,3.5) + vec2(4, 86)); + v4l2 = texture(u_gradient, vec2(v4l2.r * 3425, 0)); gl_FragColor = depth + v4l2; - gl_FragColor = mix(vec4(v4l2.rgb,1), vec4(texture(u_color, st + vec2(300, 0)).rgb, 1), u_mouse.x/u_resolution.x); + float fader = sin(u_time * 3.1415 / 10); + fader = fader * 0.5 + 0.5; + gl_FragColor = mix(vec4(v4l2.rgb,1), vec4(texture(u_color, st + vec2(300, 0)).rgb, 1), fader); } else { vec4 pointCloudColor = texture(u_ofcam, st); diff --git a/zoneb/src/ofApp.cpp b/zoneb/src/ofApp.cpp index 76c84cc..31c6108 100644 --- a/zoneb/src/ofApp.cpp +++ b/zoneb/src/ofApp.cpp @@ -377,6 +377,7 @@ void ofApp::drawMain() boundShader.setUniform1i("u_calib", calibMode == true ? 1 : 0); boundShader.setUniform2f("u_calibXY", registrationXY); boundShader.setUniform1f("u_calibScale", registrationScale); + boundShader.setUniformTexture("u_gradient", gradients.at("warm1")); boundShader.setUniform1i("u_init", 1); boundShader.render(); boundShader.setUniform1i("u_init", 0);