Text in 2D:
In the draw function, the textSize()is for the size of the text, textFont()takes the web save font,
textAlign() aligns the text in right, left or center.
The text(), takes the parameters of string or variable, x and y positions.
e.g.
push();
textSize(20);
textFont("Arial");
textAlign(CENTER);
text("Happy Coding", 400, 400 );
pop();
Text in 3D:
Make a variable (art). In the setup function, this variable will store the value from
createGraphics(width, height), which is required to make the 2D text appear on the 3D object as the texture.
e.g.
art = createGraphics(800, 800);
In the function draw, make the one pair of push() and pop() and
use the 2D text properties like textSize(), textFont() and textAlign() with the text()
join each with the art variable.
e.g.
push();
art . textSize(20);
art . textFont("Arial");
art . textAlign(CENTER);
art . text("You Win", 400, 400 );
pop();
In the other pair of push()and pop()use the texture() with the variable (art)
storing createGraphics() value to texture the 3D object.
e.g.
push();
texture(art);
plane(800, 800);
pop();
Result: