We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello I m newby in processing. Please can you help me to map 6 images in the six faces of a box.
How to give a name to a new shape created with beginShape() and endShape(), for example:
//*******************************************
PShape Instrument;
PImage photo;
photo = loadImage("image.png");
beginShape()
vertex...
vertex...
....
vertex..
endShape()
I want to affect this new shape to Instrument so that:
//*******************************************
Instrument.setTexture(photo);
Shape(Instrument);
//*******************************************
thank you
Answers
have you seen this example?
https://processing.org/examples/texturecube.html
Thank you for your response. The problem with this solution is that we map the same image on every side of the box. I want to map a different image on each side. regards
yes, but think about it.
it sets one texture at the top, then plainly draws 6 sets of vertices, 4 for each face.
if you wanted each face to be different, how would you do it? maybe change the texture between each set of 4 points?
The Shapes3D library has a Box shape which supports different textures on each face. You can install the library through the PDE and the S3D4P_Showcase example demonstrates how to do it. The relevant code is shown below