texture2D gives wrong result in experimental backend shader interface #955
-
I tried to use vec4 window_shader() {
return texelFetch( tex, ivec2( texcoord), 0);
} That worked fine. Now I'm trying to do same with return texture( tex, texcoord); I expected this to work in at least same way (no matter if default texcoord point to center or corner in the texel). gl_FragColor = vec4(texture2D(tex, vec2(texcoord.xy), 0).rgb, 1); This snippet |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hm, discovered. Looks like texture() expects normalized coordinates format in range [0:1]. Passing divided by 100 coordinates gives some meaningful feedback (tile from window miniature). Right usage: return texture( tex, texcoord / textureSize( tex, 0)); |
Beta Was this translation helpful? Give feedback.
Hm, discovered. Looks like texture() expects normalized coordinates format in range [0:1]. Passing divided by 100 coordinates gives some meaningful feedback (tile from window miniature).
Right usage: