import javax.media.opengl.*; import processing.opengl.*; import javax.media.opengl.glu.*; import com.sun.opengl.util.*; import com.sun.opengl.util.GLUT; //import SimpleCube.*; //import jp.nyatla.*; //import jp.nyatla.kGLModel.*; //import jp.nyatla.kGLModel.contentprovider.*; GLCanvas canvas; //SimpleCube sc; //KGLModelData model_data; // kei add //ContentProvider content_provider; float a = 0,a2 = 0; PImage[] b = new PImage[5]; PImage tx1,tx2; int n; int stopframe=0; void setup() { size(800, 600, OPENGL); b[0] = loadImage("P1070384s.jpg"); b[1] = loadImage("P1070448s.jpg"); b[2] = loadImage("P1070489s.jpg"); b[3] = loadImage("P1070547s.jpg"); b[4] = loadImage("P1070682s.jpg"); tx1 = b[0]; tx2 = b[1]; n=2; // textureMode(NORMALIZED); textureMode(IMAGE); //ambientLight(52, 102, 102, 0, 0, -1); } void draw() { background(128); directionalLight(255, 255, 255, 0, 0, -1); PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; // g may change GL gl = pgl.beginGL(); // always use the GL object returned by beginGL GLUT glut = new GLUT(); gl.glTranslatef(width/2, height/2, 0); gl.glRotatef(a2, 1, 0, 0); gl.glRotatef(a2*2, 0, 1, 0); // glut.glutWireTeapot(100); // glut.glutSolidTeapot(100); pgl.endGL(); noStroke(); // "arch.jpg" is 100x100 pixels in size so // the values 0 and 100 are used for the // parameters "u" and "v" to map it directly // to the vertex points translate(width*1/2, height/2, 0); rotate(a/360*TWO_PI, 0, 1, 0); // rotate(a, 1, 0, 0); beginShape(); texture(tx1); vertex(-320, -240, 0, 640, 0); vertex(320,-240, 0, 0, 0); vertex(320, 240, 0, 0, 480); vertex(-320, 240, 0, 640, 480); endShape(); beginShape(); texture(tx2); vertex(-320, -240, 0.1, 0, 0); vertex(-320 ,240, 0.1, 0, 480); vertex(320, 240, 0.1, 640, 480); vertex(320, -240, 0.1, 640, 0); endShape(); if((a == 0 || a == 180) && stopframe < 90) { stopframe++; } else { a += 1; stopframe=0; if(a == 360)a=0; } a2 += 1; if((a % 360) == 91) { tx1 = b[n]; n++; } if((a % 360) == 271) { tx2 = b[n]; n++; } if(n>4)n=0; }