The built-in AR library includes the AR renderer. This renderer will generate a view of the sketch superimposed to the camera image and automatically updated as the device moves in space. The tracking surfaces are automatically handled as well.
import processing.ar.*; ARTracker tracker; ARAnchor anchor; void setup() { fullScreen(AR); tracker = new ARTracker(this); tracker.start(); } void draw() { lights(); if (mousePressed) { if (anchor != null) anchor.dispose(); ARTrackable hit = tracker.get(mouseX, mouseY); if (hit != null) anchor = new ARAnchor(hit); else anchor = null; } if (anchor != null) { anchor.attach(); box(100); anchor.detach(); } }