Skip to content

Commit

Permalink
Merge pull request #6827 from RandomGamingDev/webgl-beginShape-type-l…
Browse files Browse the repository at this point in the history
…ine-fix

Fix for fill artifact in WebGL mode when rendering in LINE mode using beginShape
  • Loading branch information
Qianqianye authored Mar 9, 2024
2 parents 4f9c3fb + 612a943 commit 4296060
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webgl/p5.RendererGL.Immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ p5.RendererGL.prototype.endShape = function(

// LINE_STRIP and LINES are not used for rendering, instead
// they only indicate a way to modify vertices during the _processVertices() step
let is_line = false;
if (
this.immediateMode.shapeMode === constants.LINE_STRIP ||
this.immediateMode.shapeMode === constants.LINES
) {
this.immediateMode.shapeMode = constants.TRIANGLE_FAN;
is_line = true;
}

// WebGL doesn't support the QUADS and QUAD_STRIP modes, so we
Expand All @@ -239,7 +241,7 @@ p5.RendererGL.prototype.endShape = function(
this.immediateMode.shapeMode = constants.TRIANGLE_STRIP;
}

if (this._doFill) {
if (this._doFill && !is_line) {
if (
!this.geometryBuilder &&
this.immediateMode.geometry.vertices.length >= 3
Expand Down

0 comments on commit 4296060

Please sign in to comment.