Box2D-for-Processing icon indicating copy to clipboard operation
Box2D-for-Processing copied to clipboard

how to add texture to polygons?

Open loboere opened this issue 7 years ago • 1 comments

how add a PImage to polygons shapes

loboere avatar Apr 06 '18 21:04 loboere

Import the image/texture you want to apply to the desired polygon.

PImage img = loadImage("sample.jpg");

Then while creating the shape/polygon, use the texture() method, before defining the vertices.

begingShape(); texture(img); vertex(0,0); vertex(5,0); vertex(5,5); vertex(0,5); endShape();

adney11 avatar Apr 07 '18 03:04 adney11