processing / processing/p5.js

WebGL ShapeBuilder doesn't support mixed shape modes in contours

Open
#8,490 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ShapeBuilder.js around line 54 and the edge-processing TODO around line 260. Trace how contour kinds are selected and rendered, then verify that a shape containing POINTS, LINES, and TRIANGLES contours preserves each contour's mode without regressing existing WebGL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.