new to processing - is an array of cubes with different textures possible?
import processing.opengl.*;
PImage tex9;
float rotx = PI/4;
float roty = PI/4;
float spin = 0.0;
void setup()
{
size(640, 360, OPENGL);
tex9 = loadImage("tex9.jpg");
textureMode(NORMALIZED);
fill(255);
stroke(color(44,48,32));
}
void draw()
{
background(0);
noStroke();
translate(width/2.0, height/2.0, -100);
rotateX(PI/9);
rotateY(PI/5 + spin);
scale(90);
TexturedCube(tex9);
spin += 0.01;
}
void TexturedCube(PImage tex9) {
beginShape(QUADS);
texture(tex9);
// +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);
// -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);
// +Y "bottom" 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);
// -Y "top" 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);
// +X "right" 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);
// -X "left" 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();
}