Width and height return 0

You are assigning this value in the global scope of your sketch. You should initialize the values of these variable in setup() as that is the main purpose of this function. If you assign these values in the global scope, it is not guaranteed that Processing has initialized displayWidth/displayHeight properly. Also, you should use width and height instead.

Kf

6 Likes