Skip to content

beginShape(QUADS) does not work in WebGL mode #4401

@edorfaus

Description

@edorfaus

Most appropriate sub-area of p5.js?

  • WebGL

Details about the bug:

  • p5.js version: 1.0.0
  • Web browser and version: Firefox 73.0
  • Operating System: Linux 5.3.0 (Ubuntu 19.10)
  • Steps to reproduce this:
    Try to draw a QUADS shape with fill, e.g. like this:
    function setup() {
      createCanvas(256, 256, WEBGL);
    }
    function draw() {
      background(240);
      stroke(0);
      beginShape(QUADS);
      fill(255, 0, 0);
      vertex(-25, -25, 0);
      vertex(25, -25, 0);
      vertex(25, 25, 0);
      vertex(-25, 25, 0);
      fill(0, 255, 0);
      vertex(-25, 100, -25);
      vertex(25, 100, -25);
      vertex(25, 100, 25);
      vertex(-25, 100, 25);
      endShape();
    }
    According to the beginShape() reference documentation, this should draw two separate quads, which I expect to be filled in with separate colors (one red and one green).
    Instead, I get an unclosed and unfilled 7-sided polygon, as if I specified noFill() and left out the QUADS.
Further notes:
  • The same code without the QUADS argument draws the same line, but with fill between the vertices (including a gradient between the two quads).
  • The same code with p5.js 0.10.2 gives the same result, except it also logs an error about quads not being implemented yet to the console. Version 1.0.0 does not log that error.
  • Searching through the existing issues and PRs only found me some sidenote comments that mentioned quads not being handled; I did not find any issue that tracks it not being implemented yet, so I decided to add one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions