Skip to content

Commit f2771ec

Browse files
authored
Merge pull request #1177 from processing/1157-2
Fix pixel indexing formula in Optimizing WebGl Sketches Tutorial [2.0]
2 parents 6b17cff + 4e053fc commit f2771ec

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)