int myStageW = 400;
int myStageH = 400;
PFont myFont;
PGraphics pg;
PShape form;
String test = "hello";
void settings() {
size(myStageW,myStageH,P3D);
}
void setup(){
myFont = createFont("Verdana-24",50);
pg = createGraphics(width, height);
}
void draw() {
background(0, 255, 0);
pg.beginDraw();
pg.smooth();
pg.background(0);
pg.fill(255);
pg.textAlign(CENTER, CENTER);
pg.textFont(myFont, 40);
pg.text(test, width / 2, height / 2);
pg.endDraw();
form = createShape();
form.beginShape(TRIANGLE);
form.texture(pg);
form.vertex(0, -100, 0, width/2,0);
form.vertex(100, 100, 0, width, height);
form.vertex(-100, 100, 0, 0, height);
form.endShape();
pushMatrix();
translate(width/2, height/2);
shape(form, 0, 0);
popMatrix();
}
Comments