xxxxxxxxxx
20
var showingGrid = false;
function setup() {
createCanvas3D(600, 400);
background3D("#333333");
diffuse("#ff7d00");
sphere(0, 0, 0, 1);
}
function draw() {}
// when pressing H key we change the showingGrid flag to its opposite and use it as parameter for showGrid()
function keyPressed() {
if (key == "h") {
showingGrid = !showingGrid;
showGrid(showingGrid);
}
}