Skip to content

Commit b9705d9

Browse files
authored
Merge pull request #1157 from aashu2006/fix-issue-1155
Fix pixel indexing formula in Optimizing WebGl Sketches Tutorial
2 parents d783895 + 17e14e3 commit b9705d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/tutorials/en/optimizing-webgl-sketches.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ function draw() {
457457
  loadPixels();
458458
  for (let x = 0; x < width; x += 1) {
459459
    for (let y = 0; y < height; y += 1) {
460-
      let idx = (y * height + x) * 4;
460+
      let idx = (y * width + x) * 4;
461461
      let newValue;
462462
      if (pixels[idx] + noise(x, y)*50 >= 220) {
463463
        newValue = 255;

0 commit comments

Comments
 (0)