Skip to content

WebGL ShapeBuilder doesn't support mixed shape modes in contours #8490

@avinxshKD

Description

@avinxshKD

Increasing access

Increasing access

Fixes potential rendering bugs when mixing different shape modes within the same shape.

Most appropriate sub-area of p5.js?
WebGL
Feature enhancement details
Found this while looking through the ShapeBuilder code - it assumes all contours in a shape use the same rendering mode.

In ShapeBuilder.js line 54, it just grabs the mode from the first contour:

// TODO: handle just some contours having non-PATH mode
this.shapeMode = shape.contours[0].kind;

So if someone creates a shape where:

  • First contour uses POINTS

  • Second contour uses LINES

  • Third contour uses TRIANGLES

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)

Feature enhancement details

Everything gets rendered as POINTS since that's what the first contour was.

There's another TODO around line 260 in the edge processing that mentions the same limitation.

Not sure how often people actually mix modes like this, but it could definitely cause weird rendering issues. Would probably need to process each contour according to its own mode instead of using the first one for everything

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