cubicle
YaBB Newbies
Offline
Posts: 1
Texture Syntax
Apr 11th , 2009, 3:37pm
Say I have a PImage array of stuff I want to use as textures(cubebg) and I want to use a different texture on every side of a cube I am drawing how do I get it to bind a texture to only one face of the cube? ATM it binds the last texture cmd to the entire cube. beginShape(QUADS); texture(cubebg[0]); vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ,0,0); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ,1,0); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ,1,1); vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ,0,1); // Back face texture(cubebg[1]); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ,0,0); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ,1,0); vertex(w + shiftX, h + shiftY, d + shiftZ,1,1); vertex(-w/2 + shiftX, h + shiftY, d + shiftZ,0,1); // Left face //texture(cubebg[2]); vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ,0,0); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ,1,0); vertex(-w/2 + shiftX, h + shiftY, d + shiftZ,1,1); vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ,0,1); // Right face //texture(cubebg[3]); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ,0,0); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ,1,0); vertex(w + shiftX, h + shiftY, d + shiftZ,1,1); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ,0,1); // Top face vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ,0,0); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ,1,0); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ,1,1); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ,0,1); // Bottom face vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ,0,0); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ,1,0); vertex(w + shiftX, h + shiftY, d + shiftZ,1,1); vertex(-w/2 + shiftX, h + shiftY, d + shiftZ,0,1); endShape();