Closed danieltorrer closed 5 years ago
Depending on what you are doing, you might be able to get away with either
a) Not specifying P3D in your HCanvas:
canvas = (HCanvas) H.add(new HCanvas().autoClear(true));
b) Changing the autoclear setting:
canvas = (HCanvas) H.add(new HCanvas(P3D).autoClear(false));
(Tested with processing 3.3.6 on Windows...your results may vary)
close... need to add the autoClear(true) to H and remove it from HCanvas
PFont font1;
HCanvas canvas;
void setup() {
size(640,640, P3D);
H.init(this).background(#ffffff).autoClear(true);
canvas = (HCanvas) H.add(new HCanvas(P3D));
font1 = createFont("Arial", 48);
HText f1 = new HText("some regular text",48, font1);
f1.fill(#98FCFF).anchorAt(H.CENTER).loc(width/2,height/2);
f1.noStroke();
canvas.add(f1); // change this for H.add to see the difference
H.drawStage();
noLoop();
}
void draw() {}
:) joshua
edit * and if you'd like to understand why... it's because when you do autoClear(true) on HCanvas which is actually a PGraphics... processing by default executes a PGraphics.clear() if you look up .clear() it's RGBA so 0,0,0,0 - red = 0, green = 0, blue = 0, alpha = 0... so this doesn't quite behave as you would think... it's clearing with black with 0 alpha... but it actually leaves a black "residue" on our assets being painted. bummer but true.
I'm getting an extra border in all the elements added to an HCanvas. My guess is that it's coming from the PGraphics transparency and it only occurs when using P3D. I added a sample code to test it.
How can I remove them?