Skip to content

Shapes with 3 vertices in webgl mode are always closed #7379

@franolichdesign

Description

@franolichdesign

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

1.11.1

Web browser and version

Firefox 132.0.2 / Edge 130.0.2849.80

Operating system

Windows 11 Home / Pro

Steps to reproduce this

Steps:

1.Run the following code (p5 editor). The triangle at the top-left of the canvas should be an L-shaped corner but has been closed even though endShape() is called without the CLOSE constant.
2.To see the desired result, change the value of the webgl variable in line 1 to false and run the code again.

Snippet:

let webgl = true;

function setup() {
  if (webgl) {
    createCanvas(400, 400, WEBGL);
  } else {
    createCanvas(400, 400);
  }
  
  background(220);  
  stroke(0);
  strokeWeight(5);
  noFill();

  let offset = (webgl ? -100 : 100);
  translate(offset, offset);
  beginShape();
  vertex(100, 0, 0);
  vertex(0, 0, 0);
  vertex(0, 100, 0);
  endShape();
  
  translate(100, 100);
  beginShape();
  vertex(100, 0, 0);
  vertex(0, 0, 0);
  vertex(0, 100, 0);
  vertex(100, 100, 0);
  endShape();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions