【发布时间】:2021-12-31 01:52:17
【问题描述】:
我能够翻译代码并运行它,但它的行为与原始分叉不同。
https://www.shadertoy.com/view/llS3zc --orignal
https://editor.p5js.org/jorgeavav/sketches/i9cd4lE7H - 翻译
代码如下:
uniform vec2 resolution;
uniform float time;
uniform float mouse;
uniform sampler2D texture;
uniform sampler2D texture2;
void main() {
vec2 uv = gl_FragCoord.xy / resolution.xy;
vec4 texCol = vec4(texture2D(texture, uv+time/10.0));
mat3 tfm;
tfm[0] = vec3(texCol.z,0.0,0);
tfm[1] = vec3(0.0,texCol.y,0);
tfm[2] = vec3(0,0,1.0);
vec2 muv = (vec3(uv,1.0)*tfm).xy - 0.1*time;
texCol = vec4(texture2D(texture2, muv));
gl_FragColor = texCol;
}
【问题讨论】:
-
把你遇到的错误放在你的问题中可能是个好主意。我猜它的“texture3d”和“gl.texture”是问题所在。它们可能都应该是“texture2d”
-
您好,谢谢,正在运行,但行为不一样。我会更新我的问题并放置链接。
-
我编辑了,你有空可以看看吗?
标签: glsl webgl fragment-shader