Missing colors on openprocessing.org

Hi

please check https://openprocessing.org/sketch/1197450

Colors are missing, why? Is something missing on openprocessing.org?
Code works fine on my machine.
I am sure it is something silly, but I don’t see what.
Thanks

Hello,

Works with odd numbers on the Open Processing version!

// Set the display pixel to the image pixel
int div = 5;	//Seems to display correctly with odd numbers.
pixels[loc/div] = color(r, g, b);

More exploration is needed…

:)

I see, /5 fixes things indeed, thanks. No idea why.

ps. I know that Processingjs is deprecated, but somehow I need a quick cut&paste.

1 Like

You can also add | 0 after each division / operation, so its result is truncated: :heavy_division_sign:
pixels[loc/4] = color(r, g, b);pixels[loc/4 | 0] = color(r, g, b);

1 Like