You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to implement this functionality (i.e. 3d effect) across several images on the same page without having to do a reload. After digging around in the code it seems possible - just requires a few changes to clean up on each go-round.
Activity
kikeonline commentedon May 28, 2019
How do you compile this code?
kikeonline commentedon May 28, 2019
Thanks!! I made it work like this:
var glsl = require('glslify');
import GyroNorm from './lib/gyronorm';
const gn = new GyroNorm.GyroNorm();
var fragment = glsl`
#ifdef GL_ES
precision mediump float;
#endif
uniform vec4 resolution;
uniform vec2 mouse;
uniform vec2 threshold;
uniform float time;
uniform float pixelRatio;
uniform sampler2D image0;
uniform sampler2D image1;
vec2 mirrored(vec2 v) {
vec2 m = mod(v,2.);
return mix(m,2.0 - m, step(1.0 ,m));
}
void main() {
// uvs and textures
vec2 uv = pixelRatio*gl_FragCoord.xy / resolution.xy ;
vec2 vUv = (uv - vec2(0.5))*resolution.zw + vec2(0.5);
vUv.y = 1. - vUv.y;
vec4 tex1 = texture2D(image1,mirrored(vUv));
vec2 fake3d = vec2(vUv.x + (tex1.r - 0.5)*mouse.x/threshold.x, vUv.y + (tex1.r - 0.5)*mouse.y/threshold.y);
gl_FragColor = texture2D(image0,mirrored(fake3d));
}
var vertex = glslattribute vec2 a_position;
void main() {
gl_Position = vec4( a_position, 0, 1 );
}
`
toniGallardo commentedon Oct 14, 2019
Someone has the code for different images compiled to use, I'm trying to compile it, but I have a lot of errors...
Thanks in advance!
kurokh commentedon Dec 15, 2020
Hey there! Can you also upload your app.txt here? I'll be very appreciate. Thanks
PubliAlex commentedon May 17, 2021
Can somebody upload the modified src.txt compiled like app.js ? I have errors related to the use of modules when I call src.js
Thank you