JoshuaDavis icon

Untitled

JoshuaDavis | PRO | 10/23/17 03:12:04 PM UTC | 0 ⭐ | 357 👁️ | Never ⏰ | []
Java |

670 B

|

None

|

0 👍

/

0 👎

String[] texNames = { "img1.png", "img2.png", "img3.png" };
int      texLen   = texNames.length;
PImage[] textures = new PImage[texLen];
 
void setup() {
    size(500,500,P3D);
 
    for (int i = 0; i < texLen; ++i) {
        textures[i] = loadImage(texNames[i]);
    }
}
 
void draw() {
    background(#CCCCCC);
    textureMode(NORMAL);
 
    pushMatrix();
        translate(width/2,height/2);
        scale(300);
 
        strokeWeight(0);
        noStroke();
        noFill();
        tint(#FF3300);
 
        beginShape(QUADS);
            texture(textures[frameCount%texLen]);
            vertex(-0.5, -0.5,   0,0);
            vertex( 0.5, -0.5,   1,0);
            vertex( 0.5,  0.5,   1,1);
            vertex(-0.5,  0.5,   0,1);
        endShape();
    popMatrix();
}

Comments