Skip to content

Commit 89fc7eb

Browse files
committed
fix(glsl): fix bilinear texture call in sim
1 parent de9106c commit 89fc7eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/glsl/builtin-texture.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export class Texture2D {
1313

1414
get(builtIn, pos) {
1515
const { w, h, bilinear } = this;
16-
let x = pos.x * w;
17-
let y = pos.y * h;
16+
let x = pos.x * w - 0.5;
17+
let y = pos.y * h - 0.5;
1818

1919
x = (x + w) % w;
2020
y = (y + h) % h;

test/glsl/sim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ float action(vec2 one, vec2 two) {
306306

307307
const shader = ({ texture, vec2, vec4, sampler2D }) => {
308308
let bar = vec4((image = sampler2D()) => {
309-
return texture(image, vec2(0.0, 0.0));
309+
return texture(image, vec2(0.5, 0.5));
310310
});
311311
return { bar };
312312
};

0 commit comments

Comments
 (0)