Skip to content

filter() crashes on createGraphics(WEBGL) buffers #8549

@aashu2006

Description

@aashu2006

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

v2.2.1 and v2.2.2-rc.2 (reproduces in both)

Web browser and version

Google Chrome 145.0.7632.75 (Official Build, 64-bit)

Operating system

Linux Ubuntu 24.04 LTS

Steps to reproduce this

  1. Create a WebGL canvas.
  2. Create a secondary createGraphics() buffer in WEBGL mode.
  3. Draw a shape on the graphics buffer.
  4. Call filter() on the graphics buffer.

The sketch crashes with a TypeError

Snippet:

function setup() {
  createCanvas(100, 100, WEBGL);

  const g = createGraphics(100, 100, WEBGL);
  g.noStroke();
  g.fill('red');
  g.circle(0, 0, 40);

  g.filter(INVERT); // crashes
}

Console Error:

Uncaught (in promise) TypeError: e.getColor is not a function
    at _makeFilterShader (p5.min.js)
    at filter (p5.min.js)
    at Graphics.filter

Calling filter() on a createGraphics(WEBGL) renderer causes a runtime TypeError originating inside the WebGL filter shader pipeline.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions