I am writing a piece of code that draws 3D objects onto the canvas using P3D render.
I have coded it such that one can rotate the camera and pan and zoom, etc.
I want to write some info text onto the screen, but when I move the camera, the text moves as though it were a real object getting displayed; I want the text to move with the camera, so as to stay in the same place (relative to the screen, not the objects).
Is there a function or way to stop the text being an object?
This is not a bug, just a limit if mu knowledge :)
Thanks!
This is an example that rotates the text back with the movement of the camera.
It will require more work if adding additional rotations along the other axis.
void draw() {
pushMatrix();
// 3d camera here
// 3d draw here
popMatrix();
text("foo", x, y);
}
Another approach is to render your text onto a PGraphics pg, then composite it with image(pg, 0, 0) at the end of draw. Note that it can be a 2D even if the main sketch is P3D – this can give you better baseline text quality.