Thanks for your response. Following is some code that shows the problem when I
run it. (When the program runs, keyboard "q" toggles the cube's rotation
and keyboard "d" or "u" cause the camera to go down or up). I'd like text
like "screen text" not to follow the camera instruction but it does.
You'll notice several places where pushMatrix and popMatrix statements have
been commented out. No matter what combination I use I get the same
result. thanks
// stable text on screen?
float rotInc = 0.1 ;
float rot = 0.0 ;
int intColor = 0 ;
int intRot = 0 ;
float adderValue = 0.0 ; // incremented or decremented by toggle
String outString ;
float cameraParm = 1.0 ;
int cubeEdge = 100 ; // needs more flexibility
void setup() {
int windowWidth = screenWidth;
int windowHeight = screenHeight-175;
frameRate(5);
size(windowWidth, windowHeight, P3D); // use for 3d sketches
}
void draw() {
smooth() ;
background(200) ;
lights();
intRot = intRot + (1 - togglerot) ; // if toggle is 1 ("off") rotations not changed
// pushMatrix();
translate(width/2, height/2, 0);
rotateX(.4*intRot) ;
rotateY(.3*intRot) ;
rotateZ(.25*intRot) ;
// face 1 (x,y, 0 z plane)
beginShape() ;
fill(255,0,0) ;
vertex(0 , 0, 0) ;
vertex(cubeEdge, 0, 0) ;
vertex(cubeEdge, cubeEdge, 0) ;
vertex(0, cubeEdge, 0) ;
vertex(0, 0, 0) ;
endShape() ;
// face 2 (x,y, edge z plane)
beginShape() ;
fill(220,55,55) ;
vertex(0 , 0, cubeEdge) ;
vertex(cubeEdge, 0, cubeEdge) ;
vertex(cubeEdge, cubeEdge, cubeEdge) ;
vertex(0, cubeEdge, cubeEdge) ;
vertex(0, 0, cubeEdge) ;
endShape() ;
// face 3 (x,0-y, z)
beginShape() ;
fill(0,255,0) ;
vertex(0 , 0, 0) ;
vertex(cubeEdge, 0, 0) ;
vertex(cubeEdge, 0, cubeEdge) ;
vertex(0, 0, cubeEdge) ;
vertex(0, 0, 0) ;
endShape() ;
// face 4 (0,y-edge, z)
beginShape() ;
fill(50,220,50) ;
vertex(0 , cubeEdge, 0) ;
vertex(cubeEdge, cubeEdge, 0) ;
vertex(cubeEdge, cubeEdge, cubeEdge) ;
vertex(0, cubeEdge, cubeEdge) ;
vertex(0, cubeEdge, 0) ;
endShape() ;
// face 5 (0,y, z)
beginShape() ;
fill(0,0,255) ;
vertex(0 , 0, 0) ;
vertex(0, cubeEdge, 0) ;
vertex(0, cubeEdge, cubeEdge) ;
vertex(0, 0, cubeEdge) ;
vertex(0, 0, 0) ;
endShape() ;
// face 6 (x-edge,y, z)
beginShape() ;
fill(50,50,200) ;
vertex(cubeEdge, 0, 0) ;
vertex(cubeEdge, cubeEdge, 0) ;
vertex(cubeEdge, cubeEdge, cubeEdge) ;
vertex(cubeEdge, 0, cubeEdge) ;
vertex(cubeEdge, 0, 0) ;
endShape() ;
// popMatrix() ;
fill(0);
cameraParm = adderValue + height/2.0 ;
camera(width/2.0, height/2.0, (cameraParm / tan(PI*60.0 / 360.0)), width/2.0, height/2.0, 0, 0, 1, 0) ;
// popMatrix() ;
outString = "screen text " ;
text(outString, 30, 60) ;
// popMatrix() ;
}
// derived from example using keyboard toggling (up and down) of fill parm
int togglerot = 0 ; // associated w/ q
int toggle = 1 ; // a simple increment case associated with d and u
void keyPressed() {
// keypress method controlling toggles
if (key == 'q' || key == 'Q') {
togglerot = 1 - togglerot; }
if (key == 'u' || key == 'U') {
adderValue = adderValue + 1 ; }
if (key == 'd' || key == 'D') {
adderValue = adderValue - 1 ; }
}