How can you load a PNG texture to an OBJ?

My program is so far very simple. It loads an OBJ with phaser = loadShape(“PhaserTypeII.obj”);, then it displays it: shape(phaser, 0, 0) in setup and draw functions respectively. That worked, and the model shows up. I have a PNG texture that I would like to load onto the model. How can I do that? Thanks for your help!

1 Like

There is a setTexture() method which you can find in the P3D tutorial.

PImage img;
PShape globe;
	
void setup() {
  img = loadImage("earth.jpg");
  globe = createShape(SPHERE, 50);
  globe.setTexture(img);
}

See the tutorial for more methods and information related to textures.

1 Like