Skip to content

Commit

Permalink
Merge pull request #6446 from Gaurav-1306/trianglemode
Browse files Browse the repository at this point in the history
fixed issue #6440
  • Loading branch information
davepagurek authored Oct 2, 2023
2 parents 2366e1c + 617e16e commit 89b0070
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/webgl/p5.RendererGL.Immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ p5.RendererGL.prototype.endShape = function(
);
return this;
}
// When we are drawing a shape then the shape mode is TESS,
// but in case of triangle we can skip the breaking into small triangle
// this can optimize performance by skipping the step of breaking it into triangles
if (this.immediateMode.geometry.vertices.length === 3 &&
this.immediateMode.shapeMode === constants.TESS
) {
this.immediateMode.shapeMode === constants.TRIANGLES;
}

this.isProcessingVertices = true;
this._processVertices(...arguments);
this.isProcessingVertices = false;
Expand Down

0 comments on commit 89b0070

Please sign in to comment.