Hi, thanks for the idea, but for me, it does not work. I need the output image to be 6000x4000 pixel.
So I have to use textLayer.save(outfile);
I also adjusted the text size to 1.000 which is the required output text size.
If I adjus this, I have the same problem using your code
:Here is your adjusted code I am using:
public class Test3D_V2 extends PApplet {
PGraphics textLayer;
int iwidth = 800;
int iheight = 600;
String sfont = "Arial";
int mainFontSize = 1000;
String outfile = "data/3dtest.png";
public static void main(String[] args) {
String[] a = { "MAIN" };
Test3D_V2 fw = new Test3D_V2();
PApplet.runSketch(a, fw);
}
public void settings() {
size(iwidth, iheight, P3D);
}
public void setup() {
colorMode(RGB, 255);
textLayer = createGraphics(6000, 4000, P3D);
textLayer.beginDraw();
textLayer.background(0,0,80);
textLayer.textAlign(CENTER);
textLayer.textFont(createFont(sfont, mainFontSize));
textLayer.fill(color(255, 255, 255));
textLayer.translate(0, 0, 20); // change 200 to 20 to see full string
textLayer.text("California", 3000, 2000);
textLayer.save(outfile);
textLayer.endDraw();
println("click canvas and use:\nkey [p] to save picture");
}
public void draw() {
background(200,200,0); // should never be visible! or printed
image(textLayer,0,0); // show first what you created
}
public void keyPressed() {
if ( key == 'p' ) {
save(outfile);
// textLayer.save(outfile); // can NOT use!
println("saved to "+outfile);
}
}
}
The Idea of quark does indeed work, but I would like to use the P3D renderer. I also tried hamoid’s ideas but it lead to the same error.
I am open for any other idea to make P3D work. Thanks.