We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › PDF-Export only shows "TextBoxes"
Page Index Toggle Pages: 1
PDF-Export only shows "TextBoxes" (Read 334 times)
PDF-Export only shows "TextBoxes"
May 19th, 2008, 7:16pm
 
Hi.
I want to safe a frame of my sketch as pdf.

There are letters placed in 3D space. When i use
beginRaw(...) /endRaw(...) the pdf only shows boxes where the letters should be. beginRecord()/endRecord won't work because of the 3D.

What can I do?
Re: PDF-Export only shows "TextBoxes"
Reply #1 - May 19th, 2008, 7:21pm
 
Try using createFont() instead of loadFont().

http://processing.org/reference/createFont_.html
Re: PDF-Export only shows "TextBoxes"
Reply #2 - May 19th, 2008, 11:48pm
 
Did not work.
I found that:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=LibraryProblems;action=display;num=1203516711;start=1#1

But i don't know, how to do it. I tried nearly everything.
Here is my sketch. it is a little messy. Have to clean up sometime.

Code:

import saito.objloader.*;
import processing.opengl.*;
import processing.pdf.*;


OBJModel model;
float rotX = 0;
float rotY = 0;
float transY;
float transX;
float transZ;
Vertex myVert;
PFont fontA;
float x;
float y;
float z;
float[] xCoords;
float[] yCoords;
float[] zCoords;
int letter;
boolean record;

char[] alphabet = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','&','$','!','@','1','2',
'3','4','5','6','7','8','9','0'};
char[] alphabet2 = new char[40];

void setup ()
{
size(600, 500, P3D);
frameRate(30);
model = new OBJModel(this);
model.load("test3.obj"); // dma.obj in data folder



calculateLetter();
for(int k = 0; k<40; k++)
{
alphabet2[k] = alphabet[int(random(39))];
}


}

void draw()
{
if(record) {
saveFrame("line-####.tif");
}
fontA = loadFont("UniversLTStd.vlw");
textFont(fontA,6);

background(51);
noStroke();
lights();


pushMatrix();
translate(transY, transX, transZ);
scale(1);
rotateX(rotY);
rotateY(rotX);
drawLetter();
popMatrix();

if(record) {

record = false;
}
}


void mouseDragged()
{
if(keyPressed) {
if (key == 'c'){
transX -= (mouseY - pmouseY) * 0.5;
transY += (mouseX -pmouseX) * 0.5;
}
else if (key =='x'){
transZ += (mouseY - pmouseY);
}
else {};
}
else{
rotX += (mouseX - pmouseX) * 0.01;
rotY -= (mouseY - pmouseY) * 0.01;
}
}

void keyPressed() {
if (key == 'r') {
record = true;
}
}



void calculateLetter()
{
xCoords = new float[model.getVertexsize()];
yCoords = new float[model.getVertexsize()];
zCoords = new float[model.getVertexsize()];
for(int i = 0; i<model.getVertexsize(); i++)
{
xCoords[i] = model.getVertex(i).vx;
yCoords[i] = model.getVertex(i).vy;
zCoords[i] = model.getVertex(i).vz;

}
}

void drawLetter()
{

letter = 0;
for(int j = 0; j<model.getVertexsize(); j++){
letter++;
pushMatrix();
translate(xCoords[j], yCoords[j], zCoords[j]);


if (letter >=39){letter = 0;}
rotateY(radians(90));
text(alphabet[letter], xCoords[j], yCoords[j], zCoords[j]);
rotateY(radians(-90));

translate(-xCoords[j], -yCoords[j], -zCoords[j]);
popMatrix();
}

}


Page Index Toggle Pages: 1