Advertisement
JoshuaDavis

Untitled

Dec 18th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. int   myStageW = 400;
  2. int   myStageH = 400;
  3.  
  4. PFont myFont;
  5. PGraphics pg;
  6. PShape form;
  7. String test = "hello";
  8.  
  9. void settings() {
  10.     size(myStageW,myStageH,P3D);
  11. }
  12.  
  13. void setup(){
  14.     myFont = createFont("Verdana-24",50);
  15.     pg = createGraphics(width, height);
  16. }
  17.  
  18. void draw() {
  19.     background(0, 255, 0);
  20.  
  21.     pg.beginDraw();
  22.         pg.smooth();
  23.         pg.background(0);
  24.         pg.fill(255);
  25.         pg.textAlign(CENTER, CENTER);
  26.         pg.textFont(myFont, 40);
  27.         pg.text(test, width / 2, height / 2);
  28.     pg.endDraw();
  29.  
  30.     form = createShape();
  31.  
  32.     form.beginShape(TRIANGLE);
  33.         form.texture(pg);
  34.         form.vertex(0, -100,   0, width/2,0);
  35.         form.vertex(100, 100,  0, width, height);
  36.         form.vertex(-100, 100, 0, 0, height);
  37.     form.endShape();
  38.  
  39.     pushMatrix();
  40.         translate(width/2, height/2);
  41.         shape(form, 0, 0);
  42.     popMatrix();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement