P5.js: Can't call smooth on createGraphics objects when using webGL renderer.

Created on 27 Jul 2019  路  1Comment  路  Source: processing/p5.js

Nature of issue?

  • [X] Found a bug
  • [ ] Existing feature enhancement
  • [ ] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [X] WebGL
  • [ ] Other (specify if possible)

Which platform were you using when you encountered this?

  • [X] Mobile/Tablet (touch devices)
  • [ ] Desktop/Laptop
  • [ ] Others (specify if possible)

Details about the bug:

  • p5.js version: master
  • Web browser and version: Chrome 72.0.3626.96
  • Operating System: Mac 10.14
  • Steps to reproduce this:

Calling smooth() on a createGraphics layer causes an error to log to the console
Screen Shot 2019-07-27 at 10 02 27 AM

Here's the snippet that I ran:

let pg;

function setup() {
  createCanvas(windowWidth, windowHeight, WEBGL);

  pg = createGraphics(400, 400, WEBGL);
  pg.smooth();
}

It looks like this has something to do with https://github.com/processing/p5.js/pull/3552 and the way that attributes are setup before the drawing context is created.

There's another related but maybe slightly separate issue where if you call smooth on a regular (not webGL) creategraphics layer a warning will be logged by mistake.

let pg;

function setup() {
  createCanvas(windowWidth, windowHeight, WEBGL);

  pg = createGraphics(400, 400);
  pg.smooth();
}

You are trying to use setAttributes on a p5.Graphics object that does not use a WEBGL renderer.

webgl bug

Most helpful comment

Ah yes I forgot about graphics objects and smooth when I was working on the having the attributes exist before creating the context. I will take care of this next week. Thank you for finding this!

>All comments

Ah yes I forgot about graphics objects and smooth when I was working on the having the attributes exist before creating the context. I will take care of this next week. Thank you for finding this!

Was this page helpful?
0 / 5 - 0 ratings