We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm quite new to processing or pragramming at all. I want to have a static PDF file of my graphics, to make a 'poster' out of it. The point is that I can't get them well in PDF. Or the program doesn't even make a pdf or the spheres are oddly shown like on the picture.
How can I create a PDF that is exactly the same as I run the program? Like:
import processing.pdf.*;
boolean record;
void setup() {
size(1600,900,P3D);
//background(#20787E);
smooth();
}
void draw() {
if (record) {
beginRaw(PDF, "SPHERES_####.pdf");
}
lights();
pushMatrix();
translate(width/2, height/2, 0);
rotateY(radians(frameCount/3));
rotateX(radians(frameCount/3));
//tint(205, 50);
noFill();
//fill(205, 129, 173);
//ambient(205, 129, 173);
strokeWeight(0.005);
stroke(255);
//noStroke();
sphereDetail(10);
sphere(100);
popMatrix();
// PINK SPHERE
pushMatrix();
translate(width/2, height/2, 0);
rotateY(radians(frameCount/2));
rotateX(radians(frameCount/2));
noFill();
//fill(234, 136, 176, 100);
strokeWeight(0.005);
stroke(174, 99, 229);
sphereDetail(10);
sphere(280);
popMatrix();
// BLACK SPHERE
pushMatrix();
translate(width/2, height/2, 0);
rotateY(radians(frameCount/5));
rotateX(radians(frameCount/5));
noFill();
stroke(50, 100);
strokeWeight(0.1);
sphereDetail(10);
sphere(400);
popMatrix();
if(record) {
endRaw();
record = false;
}
}
void keyPressed() {
if (key == 's') {
record = true;
exit();
}
}
Answers
the screen output is lots of frames, all built up. the pdf is a single frame.
pdf also doesn't support things like lights.
Have you tried using a high screen resolution with
saveFrame()
to create a PNG or JPEG? You could then import the image file into a PDF if you really need it in PDF format.