Problems to Export to pdf
in
Core Library Questions
•
11 months ago
Hi guys,
i have this code for a very simple patch. I need export to pdf 'cause i need the hi resolution possible to print it...
But when i push the button the pdf is empty...without image!! how can i resolve!!!? and how can i take all screen like a screenshot?
But when i push the button the pdf is empty...without image!! how can i resolve!!!? and how can i take all screen like a screenshot?
tnx!
________________________________________
int nPoints = 4096; // points to draw
float complexity = 1; // wind complexity
float maxMass = .9; // max pollen mass
float timeSpeed = .0001; // wind variation speed
float phase = TWO_PI; // separate u-noise from v-noise
float windSpeed = 12; // wind vector magnitude for debug
int step = 1; // spatial sampling rate for debug
float[] pollenMass;
float[][] points;
boolean debugMode = false;
import fullscreen.*;
FullScreen fs;
import processing.pdf.*;
boolean saveOneFrame = false;
void setup() {
size(1280, 200, P2D);
fs = new FullScreen(this);
// enter fullscreen mode
fs.enter();
points = new float[nPoints][2];
pollenMass = new float[nPoints];
for(int i = 0; i < nPoints; i++) {
points[i] = new float[]{random(0, height), random(.1, width)};
pollenMass[i] = random(0, maxMass);
}
noiseDetail(14);
background(255);
}
void draw() {
if(saveOneFrame == true) {
beginRecord(PDF, "Line.pdf");
}
{
float t = frameCount * timeSpeed;
if(debugMode) {
background(227);
stroke(0);
float s = windSpeed;
for(int i = 0; i < width; i += step) {
for(int j = 0; j < height; j += step) {
float normx = map(i, 0, width, 0, 1);
float normy = map(j, 0, height, 0, 1);
float u = noise(t + phase, normx * complexity + phase, normy * complexity + phase);
float v = noise(t - phase, normx * complexity - phase, normy * complexity + phase);
pushMatrix();
translate(i, j);
line(0, 0, lerp(-windSpeed, windSpeed, u), lerp(-windSpeed, windSpeed, v));
popMatrix();
}
}
stroke(255, 0, 0);
} else {
stroke(0, 10);
}
for(int i = 0; i < nPoints; i++) {
float x = points[i][0];
float y = points[i][1];
float normx = norm(x, 0, width);
float normy = norm(y, 0, height);
float u = noise(t + phase, normx * complexity + phase, normy * complexity + phase);
float v = noise(t - phase, normx * complexity - phase, normy * complexity + phase);
float speed = (1 + noise(t, u, v)) / pollenMass[i];
x += lerp(-speed, speed, u);
y += lerp(-speed, speed, v);
if(x < 0 || x > width || y < 0 || y > height) {
x = random(0, width);
y = random(0, height);
if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}
if(debugMode)
ellipse(x, y, x, y);
else
point(x, y);
points[i][0] = x;
points[i][1] = y;
}
}
}
void mousePressed() {
saveOneFrame = true;
}
1