Skip to content

Commit 4296060

Browse files
authored
Merge pull request #6827 from RandomGamingDev/webgl-beginShape-type-line-fix
Fix for fill artifact in WebGL mode when rendering in LINE mode using beginShape
2 parents 4f9c3fb + 612a943 commit 4296060

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/webgl/p5.RendererGL.Immediate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@ p5.RendererGL.prototype.endShape = function(
223223

224224
// LINE_STRIP and LINES are not used for rendering, instead
225225
// they only indicate a way to modify vertices during the _processVertices() step
226+
let is_line = false;
226227
if (
227228
this.immediateMode.shapeMode === constants.LINE_STRIP ||
228229
this.immediateMode.shapeMode === constants.LINES
229230
) {
230231
this.immediateMode.shapeMode = constants.TRIANGLE_FAN;
232+
is_line = true;
231233
}
232234

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

242-
if (this._doFill) {
244+
if (this._doFill && !is_line) {
243245
if (
244246
!this.geometryBuilder &&
245247
this.immediateMode.geometry.vertices.length >= 3

0 commit comments

Comments
 (0)