We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › NEED Texturized 3d cube
Page Index Toggle Pages: 1
NEED Texturized 3d cube (Read 427 times)
NEED Texturized 3d cube
Nov 7th, 2007, 9:23pm
 
Can anyone help me? I need to build a texturized 3d box,
i need a different image for every side of the cube so you can rotate it with the mouse and you can see the different images.

Thank u all
Re: NEED Texturized 3d cube
Reply #1 - Nov 8th, 2007, 5:06am
 
You should have a look to the Learning section. There is a complete explanation of how to display a textured cube :

http://processing.org/learning/3d/texturecube.html

If you want each face to have a different texture, draw them in separate beginShape()/endShape() statements :

Code:
beginShape(QUADS);
texture(myImage1);
// +Z "front" face
vertex(-1, -1, 1, 0, 0);
vertex( 1, -1, 1, 1, 0);
vertex( 1, 1, 1, 1, 1);
vertex(-1, 1, 1, 0, 1);
endShape();

beginShape(QUADS);
texture(myImage2);
// -Z "back" face
vertex( 1, -1, -1, 0, 0);
vertex(-1, -1, -1, 1, 0);
vertex(-1, 1, -1, 1, 1);
vertex( 1, 1, -1, 0, 1);
endShape();

// etc...
Page Index Toggle Pages: 1