[][src]Static p5_sys::global::debugMode

pub static debugMode: DebugModeInternalType

debugMode() helps visualize 3D space by adding a grid to indicate where the ‘ground’ is in a sketch and an axes icon which indicates the +X, +Y, and +Z directions. This function can be called without parameters to create a default grid and axes icon, or it can be called according to the examples above to customize the size and position of the grid and/or axes icon. The grid is drawn using the most recently set stroke color and weight. To specify these parameters, add a call to stroke() and strokeWeight() just before the end of the draw() loop.

By default, the grid will run through the origin (0,0,0) of the sketch along the XZ plane and the axes icon will be offset from the origin. Both the grid and axes icon will be sized according to the current canvas size. Note that because the grid runs parallel to the default camera view, it is often helpful to use debugMode along with orbitControl to allow full view of the grid.

Examples

function setup() {
  createCanvas(100, 100, WEBGL);
  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
  normalMaterial();
  debugMode();
}

function draw() {
  background(200);
  orbitControl();
  box(15, 30);
  // Press the spacebar to turn debugMode off!
  if (keyIsDown(32)) {
    noDebugMode();
  }
}
function setup() {
  createCanvas(100, 100, WEBGL);
  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
  normalMaterial();
  debugMode(GRID);
}

function draw() {
  background(200);
  orbitControl();
  box(15, 30);
}
function setup() {
  createCanvas(100, 100, WEBGL);
  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
  normalMaterial();
  debugMode(AXES);
}

function draw() {
  background(200);
  orbitControl();
  box(15, 30);
}
function setup() {
  createCanvas(100, 100, WEBGL);
  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
  normalMaterial();
  debugMode(GRID, 100, 10, 0, 0, 0);
}

function draw() {
  background(200);
  orbitControl();
  box(15, 30);
}
function setup() {
  createCanvas(100, 100, WEBGL);
  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);
  normalMaterial();
  debugMode(100, 10, 0, 0, 0, 20, 0, -40, 0);
}

function draw() {
  noStroke();
  background(200);
  orbitControl();
  box(15, 30);
  // set the stroke color and weight for the grid!
  stroke(255, 0, 150);
  strokeWeight(0.8);
}

Overloads


mode either GRID or AXES


mode either GRID or AXES

gridSize? size of one side of the grid

gridDivisions? number of divisions in the grid

xOff? X axis offset from origin (0,0,0)

yOff? Y axis offset from origin (0,0,0)

zOff? Z axis offset from origin (0,0,0)


mode either GRID or AXES

axesSize? size of axes icon

xOff? X axis offset from origin (0,0,0)

yOff? Y axis offset from origin (0,0,0)

zOff? Z axis offset from origin (0,0,0)


gridSize? size of one side of the grid

gridDivisions? number of divisions in the grid

gridXOff?

gridYOff?

gridZOff?

axesSize? size of axes icon

axesXOff?

axesYOff?

axesZOff?