processing / processing/p5.js

filter() does not work after 1.9.0 if noFill() is called

Open
#7,425 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Topic

filter() was introduced in webgl mode in 1.8.0. At this time, it seems that filter() was still working even with noFill().

// version: 1.8.0
function setup() {
   createCanvas(200,200,WEBGL);
 }
  
 function draw() {
   background(0);
   noFill();
   stroke(255);
   line(-100,-100,300,300);
   filter(INVERT);
 }

cwcdcwvr3v3

However, since 1.9.0, filter() does not work if noFill() is called. Of course it doesn't work with 1.11.2 either.

r3f3f33f33f

It will be drawn when you execute fill().

function setup() {
    createCanvas(200,200,WEBGL);
}

function draw() {
    background(0);
    noFill();
    stroke(255);
    line(-100,-100,300,300);
    
    fill(255);
    
    filter(INVERT);
}

ef3d3frf3f3f3

It seems nonsensical to have to call pointless fill() to filter a sketch that just draws lines.
But I don't know if this is a bug or not.

That's all for raising the issue.

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

Reproduce the supplied WEBGL sketch with filter(), noFill(), and a line in p5.js 1.8.0 and 1.9.0 to confirm the regression. Trace the WebGL paths for filter() and noFill(); done means the filter is applied to a no-fill sketch without requiring a pointless fill() call, with coverage for the reported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.