Hello I have been getting results that I like with my code but when I want to Export as PFD file for print it's a mess!!
-Normally I have this code with a P3D render, and I like the traces from the shapes but I cannont get this shaes to maintain in my PDF file insted ad I get just one frame from the entire code.
-And also changin' my mode to OPENGL it also gets really different u cannot see anymore the traces.
HELP!
____________________________________________________
import processing.opengl.*;
import processing.pdf.*;
boolean dosave=true;
float ang;
int limit = 26;
float t;
boolean active=true;
Triangle[]triangles = new Triangle[limit];
void setup(){
size(900,600,P3D);
background(170);
smooth();
noStroke();
fill(0);
for (int i = 0; i< triangles.length; i++){
triangles[i] = new Triangle(int(random(-20, 20)), int(random(-50, 50)),
int(random(-40, 40)), int(random(-30, 30)), int(random(-30, 30)),
int(random(-40, 40)));
}
frameRate(30);
}
void draw(){
if(dosave) {
// set up PGraphicsPDF for use with beginRaw()
PGraphicsPDF pdf = (PGraphicsPDF)
beginRaw(PDF, "pdf_complex_out.pdf");
// set default Illustrator stroke styles and paint background rect.
pdf.strokeJoin(MITER);
pdf.strokeCap(SQUARE);
pdf.fill(170);
pdf.noStroke();
pdf.rect(0,0, width,height);
}
t=millis();
println(t);
rotateY(radians(ang));
rotateX(radians(ang));
rotateZ(radians(ang));
translate(mouseX,mouseY,mouseY);
fill(random(255),random(10),random(9),100);
for (int i = 0; i< triangles.length; i++){
triangles[i].display();
triangles[i].moveCorners();
}
ang=ang+.1;
if(dosave) {
endRaw();
dosave=false;
}
}
void drawRect(){
if (active==true){
rect(0,0,width,height);
}
}
void keyPressed() {
if (key == 's') {
dosave=true;
}
}
void mouseReleased() {
background(170);
}
------------------------------CLASS Triangle------------------------
class Triangle {
float x1, y1, x2, y2, x3, y3;
color c= color(10);
float time;
float increment= 0.03;
float n;
int r;
Triangle(float tempx1, float tempy1, float tempx2, float tempy2, float tempx3, float tempy3){
x1= tempx1;
y1= tempy1;
x2= tempx2;
y2= tempy2;
x3= tempx3;
y3= tempy3;
}
void display(){
rotateY(radians(r));
rotateX(radians(r));
rotateZ(radians(r));
triangle(x1+n, y1+n, x2+n, y2+n, x3, y3);
r++;
}
void moveCorners(){
n= noise(time)*100;
time +=increment;
}
}