actually in P2D and P3D there is no background for text
and this way it suddenly works
float b=0;
void setup() {
size(1024, 900, P3D);
background(0);
noStroke();
}
void draw() {
background(0);
translate(width/2+200, height/2);
draw_eye();
// if ( b > 100)
draw_text();
}
void draw_eye() {
push();
b = map(mouseY, 0, height, -190, 200);
fill(255);
beginShape();
vertex(-150, 0);
bezierVertex(-150, 0, -10, -190, 150, 0);
bezierVertex(150, 0, 10, 190, -150, 0);
endShape(CLOSE);
fill(0);
ellipse(0, 0, 100, 100);
fill(255);
ellipse(0, 0, 40, 40);
fill(122);
beginShape();
vertex(-150, 0);
bezierVertex(-150, 0, -10, -190, 150, 0);
bezierVertex(150, 0, 10, b, -150, 0);
endShape(CLOSE);
pop();
}
void draw_text() {
push();
textSize(50);
fill(0, 0, 255);
text("Z", 0, 0, 10);
text("z", 20, -10, 10);
text("Z", 30, -50, 10);
pop();
}
and it also works with the text at
text("Z", 0, 0);
text("z", 20, -10);
text("Z", 30, -50);
But note that here the text is drawn AFTER the shapes…
you draw the text prior, but try to raise it with z = 10
and so you seem to have found some renderer bug?
void draw() {
background(0);
translate(width/2, height/2);
translate(200,0);
draw_eye(); if ( b > 100) draw_text();
translate(-400,0);
draw_eye(); if ( b > 100) draw_text();
}