Convert text to PShape?

Hello,

https://processing.org/reference/PShape.html
https://processing.org/reference/PImage.html
https://processing.org/reference/texture_.html
https://processing.org/reference/textureMode_.html

From the references above I was able to:

// https://processing.org/reference/PGraphics.html
// https://processing.org/reference/texture_.html

PGraphics pg;
PImage pi;

public void settings()
  {  
  size(400, 400, P3D); 
  }

public void setup() 
  { 
  pg = createGraphics(100, 100);
  
  pg.beginDraw();
  pg.background(100);
  pg.fill(255, 255, 0);
  pg.textAlign(CENTER, CENTER);
  pg.textSize(18);
  pg.text("0", 0+10, 0+10);
  pg.text("1", 100-10, 0+10);
  pg.text("2", 100-10, 100-10);
  pg.text("3", 0+10, 100-10);
  pg.save("image.png");
  pg.endDraw();
  
  pi = loadImage("image.png");
  }

public void draw() 
  {
  image(pi, 200, 200);
  
  noStroke();
  beginShape();
  textureMode(IMAGE);
  texture(pi);
  vertex(0, 0, 0, 0); 
  vertex(100, 0, 100, 0);
  vertex(100, 100, 100, 100);
  vertex(0, 100, 0, 100);
  endShape();  
  }

image

:slight_smile:

1 Like