textP3D
in
Programming Questions
•
2 months ago
derar Dimkir's
excuse me but i have destroyed the topic !!! -
thanks for your answer but it seems to me that you only confirm what i said: the word in front is the secondly displayed, despite of its Z....
i am using 1.5.1
as for 1.5.1 the result with p3D and opengl is not the same.
here below your code but i changed the displaying order and left the same z value and add a third text that i want to put in front of the sphere using its z value: as you can see itis NOT in front; in order to do that i must firstly display the sphere and THEN add the text....
void setup(){
size(600, 600, P3D);//P3D
lights();
}
void draw(){
background(128);
noStroke();
textSize(55);
if ( mousePressed ){
// behind
//behind!!! // if i want to change that, i have to display
//this word AFTER the other, but changing the z value has no effect, except to change the size, as normal.
fill(0, 102, 153, 204);
text("blueeeeeee", 12, 65, 30);//blue :not forwards despite the z value
fill(255,0,0);//the red one
text("reddd-behind", 12, 75,10); //red :: not behind despite the z value
}
else{
fill(0, 102, 153, 204);
text("blueeeeeee", 12, 65, 30);//blue : behind despite the z value
fill(255,0,0);//the red one
text("reddd-infront", 12,75,10); // in front despite the z value
fill(0);
text("redinfrontofsphere", height/2,width/2, 150);
}
stroke(1);
pushMatrix();
translate(width/2, height/2, 100);
fill(0,255,0);// the green sphere: forwards
sphere(40);
popMatrix();
pushMatrix();
translate(width/2, height/2, -100);
fill(0,0,255); //the blue one:: behind
sphere(100);
popMatrix();
}
excuse me but i have destroyed the topic !!! -
thanks for your answer but it seems to me that you only confirm what i said: the word in front is the secondly displayed, despite of its Z....
i am using 1.5.1
as for 1.5.1 the result with p3D and opengl is not the same.
here below your code but i changed the displaying order and left the same z value and add a third text that i want to put in front of the sphere using its z value: as you can see itis NOT in front; in order to do that i must firstly display the sphere and THEN add the text....
void setup(){
size(600, 600, P3D);//P3D
lights();
}
void draw(){
background(128);
noStroke();
textSize(55);
if ( mousePressed ){
// behind
//behind!!! // if i want to change that, i have to display
//this word AFTER the other, but changing the z value has no effect, except to change the size, as normal.
fill(0, 102, 153, 204);
text("blueeeeeee", 12, 65, 30);//blue :not forwards despite the z value
fill(255,0,0);//the red one
text("reddd-behind", 12, 75,10); //red :: not behind despite the z value
}
else{
fill(0, 102, 153, 204);
text("blueeeeeee", 12, 65, 30);//blue : behind despite the z value
fill(255,0,0);//the red one
text("reddd-infront", 12,75,10); // in front despite the z value
fill(0);
text("redinfrontofsphere", height/2,width/2, 150);
}
stroke(1);
pushMatrix();
translate(width/2, height/2, 100);
fill(0,255,0);// the green sphere: forwards
sphere(40);
popMatrix();
pushMatrix();
translate(width/2, height/2, -100);
fill(0,0,255); //the blue one:: behind
sphere(100);
popMatrix();
}
1