We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Okay, this was not happening a while ago and I have NO IDEA why this stop working.
It only happens with P3D.
after a background() function happens that the shape that I working always draw in the back and not in the front as it was being draw at first. The weird thing is that is only the body NOT THE STROKE of the shape.
This is my code.
boolean isbg = false;
void setup(){
size(1200,600,P3D);
background(0);
}
void draw(){
if (isbg){
background(0);
}
ellipse(mouseX,mouseY,100,100);
}
void keyPressed(){
if (key == 'd'){
isbg = !isbg;
}
}
This happen EVERYTIME after a background() function runs.
this just destroyed an entire soft that I was working with.
Happens even if is an ellipse, a rect or a personal shape.
I ´VE TRYED EVERYTHING
It is always AFTER the background function runs.
Answers
after pressing 'd' the background changes EVERY frame, until you press 'd' again.
add line 14
(assuming that's what you want)
I see what you mean. After turning the background off and on, something very strange happens to the way the fill and stroke are applied to the canvas. White pixels fill no longer overwrite old lines.
This change to your test sketch uses
frameRate()
to make it easier to see what is happening:This looks like it might be a bug. I would suggest reporting it to Processing Issues: https://github.com/processing/processing/issues
not seeing that here in 3.0 or in 3.1.1 (linux)
Well i don´t know if actually solved the problem
Turns out I was not really needing
P3D
So i´ve change it to P2D and it works just fine
This is an optimisation applied to the stroke when working in 3D. When the optimised stroke is enabled ALL the strokes are drawn after ALL the fills.
When disabled the they are drawn in depth order.
In P2D they are drawn in the order drawn because all 2D shapes are at the same depth i.e. z=0
Thank you, @quark. Very clear explanation.
For those unfamiliar with
hint()
, I believe that:Since hints are "hacks to get around temporary workarounds inside the environment" the code is scattered about the various renderers where needed. It is also all subject to change!