From bb2f2fb91a0e3dea6876dd8370ea1f658b6a88fa Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:14:24 +0530 Subject: [PATCH 1/6] fix: added `WEBGL` mode for correct blendMode(SUBTRACT) behavior --- src/core/rendering.js | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index e2a80ea393..e9aed9dcb7 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1158,26 +1158,28 @@ p5.prototype.clearDepth = function(depth) { *
* * function setup() { - * createCanvas(100, 100); - * - * background(200); - * - * // Set the blend mode. - * blendMode(SUBTRACT); - * - * // Style the lines. - * strokeWeight(30); - * - * // Draw the blue line. - * stroke('blue'); - * line(25, 25, 75, 75); - * - * // Draw the red line. - * stroke('red'); - * line(75, 25, 25, 75); - * - * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); - * } + * // Create a canvas with WEBGL mode. + * createCanvas(100, 100, WEBGL); + * + * // Set the background color. + * background(200); + * + * // Set the blend mode to SUBTRACT. + * blendMode(SUBTRACT); + * + * // Style the lines. + * strokeWeight(30); + * + * // Draw the blue line. + * stroke('blue'); + * line(-25, -25, 25, 25); // Adjusted coordinates for WEBGL + * + * // Draw the red line. + * stroke('red'); + * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL + * + * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); + * } * *
*/ From 00c3940200419b664f58a91e1718da34f49cdade Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:19:52 +0530 Subject: [PATCH 2/6] CI fixes --- src/core/rendering.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index e9aed9dcb7..2b720ef20a 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1160,24 +1160,24 @@ p5.prototype.clearDepth = function(depth) { * function setup() { * // Create a canvas with WEBGL mode. * createCanvas(100, 100, WEBGL); - * + * * // Set the background color. * background(200); - * + * * // Set the blend mode to SUBTRACT. * blendMode(SUBTRACT); - * + * * // Style the lines. * strokeWeight(30); - * + * * // Draw the blue line. * stroke('blue'); * line(-25, -25, 25, 25); // Adjusted coordinates for WEBGL - * + * * // Draw the red line. * stroke('red'); * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL - * + * * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); * } * From 49e767c24fbe405c125e6ce129d147982622b784 Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:30:20 +0530 Subject: [PATCH 3/6] Minor tweaks --- src/core/rendering.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index 2b720ef20a..7618e54dd0 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1158,27 +1158,27 @@ p5.prototype.clearDepth = function(depth) { *
* * function setup() { - * // Create a canvas with WEBGL mode. - * createCanvas(100, 100, WEBGL); + * // Create a canvas with WEBGL mode. + * createCanvas(100, 100, WEBGL); * - * // Set the background color. - * background(200); + * // Set the background color. + * background(200); * - * // Set the blend mode to SUBTRACT. - * blendMode(SUBTRACT); + * // Set the blend mode to SUBTRACT. + * blendMode(SUBTRACT); * - * // Style the lines. - * strokeWeight(30); + * // Style the lines. + * strokeWeight(30); * - * // Draw the blue line. - * stroke('blue'); - * line(-25, -25, 25, 25); // Adjusted coordinates for WEBGL + * // Draw the blue line. + * stroke('blue'); + * line(-25, -25, 25, 25); // Adjusted coordinates for WEBGL * - * // Draw the red line. - * stroke('red'); - * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL + * // Draw the red line. + * stroke('red'); + * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL * - * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); + * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); * } * *
From eef0bfe0bc4cc30f38f9b2907c53803c7e35fc99 Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:32:30 +0530 Subject: [PATCH 4/6] Update rendering.js --- src/core/rendering.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index 7618e54dd0..c5b01bd527 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1179,7 +1179,7 @@ p5.prototype.clearDepth = function(depth) { * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL * * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); - * } + * } * * */ From e8dca69126a302db55d19622841b326d3f6c8aa1 Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:41:03 +0530 Subject: [PATCH 5/6] fix: remove adjusted coordinates comment --- src/core/rendering.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index c5b01bd527..be340e3ce2 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1172,11 +1172,11 @@ p5.prototype.clearDepth = function(depth) { * * // Draw the blue line. * stroke('blue'); - * line(-25, -25, 25, 25); // Adjusted coordinates for WEBGL + * line(-25, -25, 25, 25); * * // Draw the red line. * stroke('red'); - * line(25, -25, -25, 25); // Adjusted coordinates for WEBGL + * line(25, -25, -25, 25); * * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); * } From aab213252902d4c67c0aa08e6a41b687a0ece242 Mon Sep 17 00:00:00 2001 From: Abhinav kumar <126642111+Abhinavcode13@users.noreply.github.com> Date: Thu, 5 Sep 2024 21:43:54 +0530 Subject: [PATCH 6/6] small nit --- src/core/rendering.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/rendering.js b/src/core/rendering.js index be340e3ce2..de8690afcc 100644 --- a/src/core/rendering.js +++ b/src/core/rendering.js @@ -1172,11 +1172,11 @@ p5.prototype.clearDepth = function(depth) { * * // Draw the blue line. * stroke('blue'); - * line(-25, -25, 25, 25); + * line(-25, -25, 25, 25); * * // Draw the red line. * stroke('red'); - * line(25, -25, -25, 25); + * line(25, -25, -25, 25); * * describe('A yellow line and a turquoise line form an X on a gray background. The area where they overlap is green.'); * }