| |
begin2D() / end2D()
When you start working in 3D, Processing commands such as text( ) draw to a plane floating in space, rather than onto your screen. By calling camera.begin2D(), commands are drawn directly to your screen, rather than floating in space.
Example Code
import kaleidoscope.*;
import toxi.geom.*;
Camera cam;
PFont font;
void setup(){
size(400, 400, P3D);
cam = new AppCamera( this );
font = loadFont( "OratorStd-24.vlw" );
textFont( font );
}
void draw(){
background(140, 150, 255);
lights();
stroke(255); //Draw the origin
line( 10000, 0, 0, -10000, 0, 0);
line( 0, 10000, 0, 0, -10000, 0);
line( 0, 0, 10000, 0, 0, -10000);
cam.begin2D();
fill( 0 );
text("Frame Rate: " + frameRate , 30, 30);
}
|