Advertisement
JoshuaDavis

Untitled

Oct 23rd, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. String[] texNames = { "img1.png", "img2.png", "img3.png" };
  2. int      texLen   = texNames.length;
  3. PImage[] textures = new PImage[texLen];
  4.  
  5. void setup() {
  6.     size(500,500,P3D);
  7.  
  8.     for (int i = 0; i < texLen; ++i) {
  9.         textures[i] = loadImage(texNames[i]);
  10.     }
  11. }
  12.  
  13. void draw() {
  14.     background(#CCCCCC);
  15.     textureMode(NORMAL);
  16.  
  17.     pushMatrix();
  18.         translate(width/2,height/2);
  19.         scale(300);
  20.  
  21.         strokeWeight(0);
  22.         noStroke();
  23.         noFill();
  24.         tint(#FF3300);
  25.  
  26.         beginShape(QUADS);
  27.             texture(textures[frameCount%texLen]);
  28.             vertex(-0.5, -0.5,   0,0);
  29.             vertex( 0.5, -0.5,   1,0);
  30.             vertex( 0.5,  0.5,   1,1);
  31.             vertex(-0.5,  0.5,   0,1);
  32.         endShape();
  33.     popMatrix();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement