Setting canvas and background color in setup() not working

#1

function setup() {
createCanvas(windowWidth, windowHeight);
background(0, 0, 0);
}

this is pretty much how my setup() function starts. Everything in draw() works fine, but my canvas is never set and my background color is also never set. I don’t understand why this could happen. Any ideas?

#2

in p5.js i not see a problem.

https://editor.p5js.org/kll/sketches/hXy_Ij1gB
for resize…
https://editor.p5js.org/kll/sketches/SkZFY5Qg4

also try Processing 3.5.3 p5.js mode OK


so you need to tell us more about your environment…

when you say draw works??
and it starts with a background or image
you might never see the background set from setup()

#3

Sorry, I had a lot of code already, I think I figured it out now, I had a line pixelDensity(1) or something that caused this, I don’t remember why I had it. Thank you for the reply